To avoid diffs, change to vpc_security_group_ids - #12
Open
bennythejudge wants to merge 1 commit into
Open
Conversation
I noticed that using `security_groups` instead of `vpc_security_group_ids` in the EC2s, causes diffs at every `terraform apply`.
```
-/+ aws_instance.app.0
[...]
security_groups.#: "0" => "1" (forces new resource)
security_groups.2027228756: "" => "sg-d95494bf" (forces new resource)
[...]
-/+ aws_instance.app.1
security_groups.#: "0" => "1" (forces new resource)
security_groups.2027228756: "" => "sg-d95494bf" (forces new resource)
[...]
-/+ aws_instance.nat
[...]
security_groups.#: "0" => "2" (forces new resource)
security_groups.2027228756: "" => "sg-d95494bf" (forces new resource)
security_groups.4096171602: "" => "sg-845898e2" (forces new resource)
[...]
```
Changing the `security_groups` to `vpc_security_group_ids`, no more diffs:
```
17:11 $ tf plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
aws_key_pair.deployer: Refreshing state... (ID: deployer-key)
aws_vpc.default: Refreshing state... (ID: vpc-819ceae5)
aws_internet_gateway.default: Refreshing state... (ID: igw-9955bbfd)
aws_security_group.web: Refreshing state... (ID: sg-a95a9acf)
aws_security_group.default: Refreshing state... (ID: sg-d95494bf)
aws_security_group.nat: Refreshing state... (ID: sg-845898e2)
aws_route_table.public: Refreshing state... (ID: rtb-8299a6e6)
aws_subnet.public: Refreshing state... (ID: subnet-334d6a6b)
aws_instance.nat: Refreshing state... (ID: i-037734af6c23c7821)
aws_route_table_association.public: Refreshing state... (ID: rtbassoc-8c1ba1eb)
aws_route_table.private: Refreshing state... (ID: rtb-a581bec1)
aws_subnet.private: Refreshing state... (ID: subnet-e82700b0)
aws_instance.app.0: Refreshing state... (ID: i-0b958ec00319d37f8)
aws_instance.app.1: Refreshing state... (ID: i-0d001d48d0c3daa15)
aws_route_table_association.private: Refreshing state... (ID: rtbassoc-66cd4801)
aws_elb.app: Refreshing state... (ID: example-elb)
No changes. Infrastructure is up-to-date.
This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, Terraform
doesn't need to do anything.
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that using
security_groupsinstead ofvpc_security_group_idsin the EC2s, causes diffs at everyterraform apply.Changing the
security_groupstovpc_security_group_ids, no more diffs: