-
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
Terraform fails to retrieve schema.Set resource attribute value containing references to other resources. #873
Comments
I haven't been able to repro this so far, but watched it repro on someone else's. I thought maybe race condition and made this script, but nothing so far:
|
Here is the $ terraform plan
2015/01/31 14:52:57 [INFO] Terraform version: 0.3.7 dev 170ddc4bd48d4ab854ab458e1446180ccdb88095+CHANGES
2015/01/31 14:52:57 Detected home directory from env var: /Users/guillaume
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: atlas = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-atlas
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: aws = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-aws
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: azure = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-azure
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: cloudflare = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-cloudflare
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: cloudstack = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-cloudstack
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: consul = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-consul
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: digitalocean = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-digitalocean
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: dnsimple = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-dnsimple
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: google = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-google
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: heroku = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-heroku
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: mailgun = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-mailgun
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: null = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-null
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: test = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-test
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: file = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provisioner-file
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: local-exec = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provisioner-local-exec
2015/01/31 14:52:57 [DEBUG] Discoverd plugin: remote-exec = /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provisioner-remote-exec
2015/01/31 14:52:57 Detected home directory from env var: /Users/guillaume
2015/01/31 14:52:57 [DEBUG] Attempting to open CLI config file: /Users/guillaume/.terraformrc
2015/01/31 14:52:57 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2015/01/31 14:52:57 [DEBUG] Creating graph for path: [root]
2015/01/31 14:52:57 [DEBUG] Starting plugin: /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-test []string{"/Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-test"}
2015/01/31 14:52:57 [DEBUG] Waiting for RPC address for: /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-test
2015/01/31 14:52:57 Detected home directory from env var: /Users/guillaume
2015/01/31 14:52:57 terraform-provider-test: 2015/01/31 14:52:57 Plugin address: unix /var/folders/6p/3fj1m23j24lbd4x7brp7dfgw0000gn/T/tf-plugin108791787
2015/01/31 14:52:57 [DEBUG] Graph [root] created and valid. 6 nouns.
2015/01/31 14:52:57 [INFO] Validating provider: test
2015/01/31 14:52:57 [DEBUG] test_element.elt003: expanding to count = 1
2015/01/31 14:52:57 [DEBUG] test_element.elt002: expanding to count = 1
2015/01/31 14:52:57 [DEBUG] test_element.elt001: expanding to count = 1
2015/01/31 14:52:57 [INFO] Validating resource: test_element.elt003
2015/01/31 14:52:57 [INFO] Validating resource: test_element.elt002
2015/01/31 14:52:57 [INFO] Validating resource: test_element.elt001
2015/01/31 14:52:57 [DEBUG] test_container.ctn001: expanding to count = 1
2015/01/31 14:52:57 [INFO] Validating resource: test_container.ctn001
2015/01/31 14:52:57 [DEBUG] Creating graph for path: [root]
2015/01/31 14:52:57 [DEBUG] Graph [root] created and valid. 6 nouns.
2015/01/31 14:52:57 [DEBUG] Creating graph for path: [root]
Refreshing Terraform state prior to plan...
2015/01/31 14:52:57 [DEBUG] Graph [root] created and valid. 6 nouns.
2015/01/31 14:52:57 [INFO] Configuring provider: test
2015/01/31 14:52:57 [DEBUG] test_element.elt003: expanding to count = 1
2015/01/31 14:52:57 [DEBUG] test_element.elt002: expanding to count = 1
2015/01/31 14:52:57 [DEBUG] test_element.elt001: expanding to count = 1
2015/01/31 14:52:57 [INFO] Module root walking: test_element.elt003 (Graph node: test_element.elt003)
2015/01/31 14:52:57 [DEBUG] test_element.elt003: Not refreshing, ID is empty
2015/01/31 14:52:57 [INFO] Module root walking: test_element.elt002 (Graph node: test_element.elt002)
2015/01/31 14:52:57 [DEBUG] test_element.elt002: Not refreshing, ID is empty
2015/01/31 14:52:57 [INFO] Module root walking: test_element.elt001 (Graph node: test_element.elt001)
2015/01/31 14:52:57 [DEBUG] test_element.elt001: Not refreshing, ID is empty
2015/01/31 14:52:57 [DEBUG] test_container.ctn001: expanding to count = 1
2015/01/31 14:52:57 [INFO] Module root walking: test_container.ctn001 (Graph node: test_container.ctn001)
2015/01/31 14:52:57 [DEBUG] test_container.ctn001: Not refreshing, ID is empty
2015/01/31 14:52:57 [DEBUG] Creating graph for path: [root]
2015/01/31 14:52:57 [DEBUG] Graph [root] created and valid. 6 nouns.
2015/01/31 14:52:57 [INFO] Configuring provider: test
2015/01/31 14:52:57 [DEBUG] test_element.elt003: expanding to count = 1
2015/01/31 14:52:57 [DEBUG] test_element.elt002: expanding to count = 1
2015/01/31 14:52:57 [DEBUG] test_element.elt001: expanding to count = 1
2015/01/31 14:52:57 [INFO] Module root walking: test_element.elt003 (Graph node: test_element.elt003)
2015/01/31 14:52:57 [DEBUG] test_element.elt003: Executing diff
2015/01/31 14:52:57 [INFO] Module root walking: test_element.elt002 (Graph node: test_element.elt002)
2015/01/31 14:52:57 [DEBUG] test_element.elt002: Executing diff
2015/01/31 14:52:57 [INFO] Module root walking: test_element.elt001 (Graph node: test_element.elt001)
2015/01/31 14:52:57 [DEBUG] test_element.elt001: Executing diff
2015/01/31 14:52:57 [DEBUG] test_element.elt003: Diff: &terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"id":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x2}}, Destroy:false, DestroyTainted:false}
2015/01/31 14:52:57 [DEBUG] test_element.elt002: Diff: &terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"id":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x2}}, Destroy:false, DestroyTainted:false}
2015/01/31 14:52:57 [DEBUG] test_element.elt001: Diff: &terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"id":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x2}}, Destroy:false, DestroyTainted:false}
2015/01/31 14:52:57 [DEBUG] test_container.ctn001: expanding to count = 1
2015/01/31 14:52:57 [INFO] Module root walking: test_container.ctn001 (Graph node: test_container.ctn001)
2015/01/31 14:52:57 [DEBUG] test_container.ctn001: Executing diff
2015/01/31 14:52:57 [DEBUG] test_container.ctn001: Diff: &terraform.InstanceDiff{Attributes:map[string]*terraform.ResourceAttrDiff{"elements.#":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Type:0x0}, "id":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:true, Type:0x2}}, Destroy:false, DestroyTainted:false}
The Terraform execution plan has been generated and is shown below.
2015/01/31 14:52:57 waiting for all plugin processes to complete...
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed.
2015/01/31 14:52:57 [DEBUG] /Users/guillaume/dev/go/src/github.com/hashicorp/terraform/bin/terraform-provider-test: plugin process exited
Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.
+ test_container.ctn001
elements.#: "" => "<computed>"
+ test_element.elt001
+ test_element.elt002
+ test_element.elt003 |
And the
|
Fixed by #967 apparently! |
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. |
For instance, using the sample provider provider.go and the corresponding terraform configuration :
Terraform creates the 3
test_element
resources but then, when it tries to create thetest_container
resource it doesn't give the right IDs when getting it withd.Get("elements").(*schema.Set)
In the log, we can see the
elements
set is wrongThis is a regression introduced by b4bf813. When testing with the commit just before aa82c10 it works great as shown in the following log
The text was updated successfully, but these errors were encountered: