Closed cklogin closed 1 year ago
@cklogin thanks for submitting an issue. Security groups can be added in different ways. And it really depends on module contents. It would be easier to track down the root cause if you can provide the simplest possible terraform script that can reproduce an issue, e.g. only compute and security groups resources without modules.
I have observed this exact same issue at times as well.
There is a similar issue reported at https://github.com/terraform-provider-openstack/terraform-provider-openstack/issues/1460. Note the hint about only placing security groups on ports instead of on the instance (https://github.com/terraform-provider-openstack/terraform-provider-openstack/issues/1460#issuecomment-1338949069).
thanks, looks like placing SG to the ports works fine, thanks :)
Hi,
I’m deploying environments in OpenStack using Terraform, and I’ve encountered an issue where the Terraform code doesn’t attach security groups to instances on the first deployment. Following Terraform Apply I can see that the security groups are fully created before the instances are created.
I’m looking for help in finding a solution to this issue. I’ve tried the depends_on parameter in the module that creates the instances to explicitly specify that the instances depend on the creation of the security groups but that didn’t resolve it. I need to run Terraform Apply again to make sure all security rules have been attached to the instances.
Here’s an example of how the Terraform code currently looks:
this is the main provider.tf code:
here is the terraform first apply output:
here is the terraform apply second output:
Here is the initial Plan
The second Plan was run after I noticed security groups are not attached to the instances
Second Apply
Terraform Version
1.4.0
Affected Resource(s)
Please list the resources as a list, for example:
Expected Behavior
All security groups should be attached to the instances on the first Terraform apply
Actual Behavior
From the above logs (the second plan is the really informative one), it can be seen that terraform-provider-openstack truly believed that it had set the security groups up - but then, on the second run, it found the settings had been undone or not taken effect, so it had to do them again.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
I am using modules hosted on the GitLab for:
compute This occurred after I implemented Modules to my TF I also tried,
depends_on
for the instance module :