-
Notifications
You must be signed in to change notification settings - Fork 368
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
Wrong number of interfaces using compute_instance module #222
Comments
A friend of mine has found the bug.
When you set the one network again you overwrite the configuration from the instance template. The fix is to rely 100% in the instance template
Would you guys accept a PR for such change? |
It's complicated because we also need to allow overrides as a feature request (where people want to deploy the same template on multiple networks). The better thing to do would be to have the network interface block be conditional on whether |
Sounds good. I'm going to work on it when I find some time to spare. |
I also ran into this issue while trying to add multiple interfaces to an instance. Another wrinkle to the issue is that when trying to add multiple interfaces to an instance when constraints/compute.vmExternalIpAccess is enabled it fails when trying to add an external ip. From the GCP api's perspective access_config is optional, but from the module's perspective nat_ip and network_ip are required. If there's no value for nat_ip a random external ip gets assigned, but if vmExternalIpAccess is enabled if all just fails. In order for the external address not to bbe randomly assigned access_config need to be ommited. Instead of getting rid of network_interface I wrapped the appropriate bits with try(), passing along a null value when no value is provided, and it seems to work properly now.
With nat_ip wrapped in the try() you can pass null from the module and no external ip will get generated. I can submit a PR if you like. I've never done that before so if there's guidelines on submitting a PR that would be helpful. |
TL;DR
I have an instance template with multiple NICs and a compute instance that uses that instance template. The instance created matches everything on the instance template but the number of NICs.
Expected behavior
All configurations in the instance template to be applied in the instance created including all subnets in the instance template.
Observed behavior
I can see that the instance template is properly created because if I use the console to create the instance using the same instance template, the instance is properly created with all the subnets (NICs).
Terraform Configuration
Terraform Version
Additional information
No response
The text was updated successfully, but these errors were encountered: