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

address conflict btw list-type attributes and ignore_changes #9791

Closed

Conversation

br0ch0n
Copy link
Contributor

@br0ch0n br0ch0n commented Nov 2, 2016

fixes #9043

fixes hashicorp#9043

Change-Id: I7b047625c404e64521f5999e032edfe4a6d536c7
@Jonnymcc
Copy link
Contributor

Jonnymcc commented Mar 8, 2017

This fixes the issue in #9043 but introduces another artifact. Not only does it fix my security groups but it also lists the ebs_block_device as changing even though it is not.

 ebs_block_device.#:                                "1" => "1"
    ebs_block_device.3133358816.delete_on_termination: "true" => "true"
    ebs_block_device.3133358816.device_name:           "xvdb" => "xvdb"
    ebs_block_device.3133358816.encrypted:             "true" => "true"
    ebs_block_device.3133358816.volume_size:           "50" => "50"
    ebs_block_device.3133358816.volume_type:           "gp2" => "gp2"
    vpc_security_group_ids.#:                          "2" => "3"
    vpc_security_group_ids.2422803500:                 "sg-7656d80b" => "sg-7656d80b"
    vpc_security_group_ids.408308980:                  "sg-f175848e" => "sg-f175848e"
    vpc_security_group_ids.988224174:                  "" => "sg-75a779d"

I noticed this while debugging...
[INFO] atrrs Checking ebs_block_device.3133358816.iops, &{150 %!s(bool=true) %!s(bool=false) <nil> %!s(bool=false) %!s(bool=false) %!s(terraform.DiffAttrType=0)}, 150,

Here is the debug code,

changingSiblings := make(map[string]bool)
	for k, v := range diff.CopyAttributes() {
		log.Printf("[INFO] atrrs Checking %s, %s, %s, %s", k, v, v.Old, v.New)
		if listTypeAttrKeys[strings.Split(k, ".")[0]] && v.Old != v.New {
			changingSiblings[strings.Split(k, ".")[0]] = true
		}
	}

My guess is that since I am not specifying a number of iops it is detecting it as a change from "150" => "". Setting the iops in my TF template to 150 actually makes the reported change disappear. Should find a solution that doesn't require settings iops though.

Also, I experienced this issue by spinning up instances referencing user_data resources and later removing those resources and setting lifecyle
ignore_changes = ["user_data"]

In the meantime while waiting for this fix my workaround is to revert the changed that removed the user_data resources, that way I can remove the lifecyle changes and, as expected, I do not have the issue adding security groups anymore.

@br0ch0n
Copy link
Contributor Author

br0ch0n commented Mar 8, 2017

by chance did you see if it was going to (or did) actually change your block device? Or was it purely screen spam?

@Jonnymcc
Copy link
Contributor

Jonnymcc commented Mar 8, 2017

With Terraform plan it shows as if it would modify the attribute. I did not test if it actually did.

@Jonnymcc
Copy link
Contributor

Jonnymcc commented Mar 8, 2017

It actually shows as the only change to other instances. Which leads me to believe that Terraform would always think there is a change to apply even when there is none.

@br0ch0n
Copy link
Contributor Author

br0ch0n commented Mar 9, 2017

OK cool, thanks for testing! I'll try and reproduce and see what I can do.

@josephholsten
Copy link
Contributor

I wonder if this is necessary after #12897

@br0ch0n
Copy link
Contributor Author

br0ch0n commented Jun 15, 2017

Yaa, I should close this since it's supposedly fixed. I haven't tested personally tho.

@br0ch0n br0ch0n closed this Jun 15, 2017
@ghost
Copy link

ghost commented Apr 8, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All vpc_security_group_ids being removed when updating instance Security Groups
4 participants