Skip to content
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

Terraform Forces New Resource each time #7

Closed
mckayjuk opened this issue Dec 17, 2017 · 4 comments
Closed

Terraform Forces New Resource each time #7

mckayjuk opened this issue Dec 17, 2017 · 4 comments

Comments

@mckayjuk
Copy link
Owner

Each time I run my plan, my existing servers are destroyed and new ones built. Looking through the log a number of entries have 'forces new resource' next to them... listed below

-/+ aws_instance.Web[0] (new resource required)
id: "i-0b5e13fdd020b0917" => (forces new resource)
security_groups.#: "0" => "1" (forces new resource)
security_groups.3026238325: "" => "sg-a7ec92df" (forces new resource)

@mckayjuk
Copy link
Owner Author

Security Groups could be due to the following...

hashicorp/terraform#7039

I have been using Security Groups instead of vac_security groups.

Testing

@mckayjuk
Copy link
Owner Author

The instance ID appears to be related to

hashicorp/terraform#3449

Using elements seems to force a new build (and destroy the old)

Testing ListVar as noted in link above.

@mckayjuk
Copy link
Owner Author

Fixed by changing:

subnet_id = "${element(var.public-subnets, count.index)}" to .....
subnet_id = "${var.public-subnets [count.index]}"

I can now create upto as many machines as I state subnets... an improvement on how I would create 4 machines if only 3 subnets listed would be useful.

@mckayjuk
Copy link
Owner Author

Closing... improvement can be put on backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant