-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
google_compute_instance: network_interface constantly forces resource recreation #1394
Comments
Might be related to #1286. |
I was just going to post the same issue after hitting that yesterday as well. I did help me around that for now by editing the terraform config once the resource got created:
which is a stupid way around this but getting me working again. I'm currently looking for a way to turn the Network self_link into a usable name via the google api for submitting a patch - but so far I'm not that lucky. Maybe the provider tests should have a case for testing the plan resolution after a resource got created and test for the number of needed transformations to be zero. |
This does fix my current problems in a first stupid way but I doubt it will fix the complete problem: diff --git a/builtin/providers/google/resource_compute_instance.go b/builtin/providers/google/resource_compute_instance.go
index d89e82a..40a7fe6 100644
--- a/builtin/providers/google/resource_compute_instance.go
+++ b/builtin/providers/google/resource_compute_instance.go
@@ -3,6 +3,7 @@ package google
import (
"fmt"
"log"
+ "path"
"time"
"github.com/hashicorp/terraform/helper/hashcode"
@@ -572,7 +573,7 @@ func resourceComputeInstanceRead(d *schema.ResourceData, meta interface{}) error
networkInterfaces = append(networkInterfaces, map[string]interface{}{
"name": iface.Name,
"address": iface.NetworkIP,
- "network": iface.Network,
+ "network": path.Base(iface.Network),
"access_config": accessConfigs,
})
} |
I've hit this bug as well, using the workaround proposed by @MerlinDMC for now. |
Fix #1394, network value for network_interface
Hey folks, just merged @dainis's fix into master. If that doesn't solve this issue, let me know and we can re-evaluate. 👍 |
worksforme thanks! |
I can also confirm that this works, thanks a lot! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I've hit the following issue when trying to migrate from 0.3.7 to 0.4.0.
Basically,
google_compute_instance
is unusable, because it tries to recreate itself all the time.Configuration:
First, I run
terraform apply
:Next, I run
terraform plan
with no changes to configuration:As you can see, Terraform insists on recreating instance because
network_interface.0.network
value is different.The text was updated successfully, but these errors were encountered: