-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
availability_zone getting cleared on aws vpn gateway in statefile #4752
Comments
availability zone Fixes #4752 According to the AWS Documentation, when `describing-vpn-gateways` ``` AvailabilityZone -> (string) The Availability Zone where the virtual private gateway was created, if applicable. This field may be empty or not returned. ``` Therefore, if we pass an availability zone as part of vpn gateway, then it may come back as an empty string. If we set this empty string back to state, then the next plan will look as follows: ``` -/+ aws_vpn_gateway.vpn_gateway availability_zone: "" => "us-west-2a" (forces new resource) tags.%: "1" => "1" tags.Name: "vpn-us-west-2" => "vpn-us-west-2" vpc_id: "vpc-1e9da47a" => "vpc-1e9da47a" Plan: 1 to add, 0 to change, 1 to destroy. ``` If the availability_zone comes back from AWS as an empty string, then we should not set it to state to avoid forcing a new resource for the user ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSVpnGateway_withAvailabilityZoneSetToState' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/09/03 17:10:57 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSVpnGateway_withAvailabilityZoneSetToState -timeout 120m === RUN TestAccAWSVpnGateway_withAvailabilityZoneSetToState --- FAIL: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (36.11s) testing.go:265: Step 0 error: Check failed: Check 2/2 error: aws_vpn_gateway.foo: Attribute 'availability_zone' expected "us-west-2a", got "" FAIL exit status 1 FAIL github.com/hashicorp/terraform/builtin/providers/aws 36.130s make: *** [testacc] Error 1 [stacko@Pauls-MacBook-Pro:~/Code/go/src/github.com/hashicorp/terraform on master] % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSVpnGateway_withAvailabilityZoneSetToState' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/09/03 17:12:25 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSVpnGateway_withAvailabilityZoneSetToState -timeout 120m === RUN TestAccAWSVpnGateway_withAvailabilityZoneSetToState --- PASS: TestAccAWSVpnGateway_withAvailabilityZoneSetToState (46.50s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 46.517s ```
Hi @qgriffith Apologies for the issue here and how long it has taken to get this worked on. I have just opened PR #8645 to solve the issue Paul |
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. |
Using terraform 0.6.9 the availability_zone is getting cleared from the state file and terraform is trying to re-create the vpn becasue the state file contains a blank availability_zone when the vpn has a availability_zone attached to it. When manually editing the state file to put the availability_zone back, the next plan will clear the availability_zone and try to re-build the vpn.
State file
We are setting the avalability_zone on the resource config for the vpn. The root cause could be that AWS API may not be returning the avalabilty_zone and terafform is blanking it out. Instead if AWS returns a blank value the current value should be kept.
The text was updated successfully, but these errors were encountered: