-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Data sources don't return more than one TypeSet's #7198
Comments
I took a closer look into this issue and figured out that the Here is the terraform code, responsible for this behavior: https://github.com/hashicorp/terraform/blob/ac4fff416318bf0915a0ab80e062a99ef3724334/helper/schema/serialize.go#L103 |
… block contains only Computed attributes Reference: hashicorp/terraform-provider-aws#7198 When a resource schema contains the following: ```go "config_block_attribute": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute1": { Type: schema.TypeBool, Computed: true, }, "attribute2": { Type: schema.TypeString, Computed: true, }, }, }, }, ``` The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
Hi @kayrus - thanks for opening this bug report, and huge thanks for the work you did to discover the issue with the |
… block contains only Computed attributes Reference: hashicorp/terraform-provider-aws#7198 Reference: hashicorp/terraform-provider-aws#10045 Reference: hashicorp/terraform-provider-aws#10339 Reference: hashicorp/terraform#22719 When a resource schema contains the following: ```go "config_block_attribute": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute1": { Type: schema.TypeBool, Computed: true, }, "attribute2": { Type: schema.TypeString, Computed: true, }, }, }, }, ``` The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
… block contains only Computed attributes Reference: hashicorp/terraform-provider-aws#7198 Reference: hashicorp/terraform-provider-aws#10045 Reference: hashicorp/terraform-provider-aws#10339 Reference: hashicorp/terraform#22719 When a resource schema contains the following: ```go "config_block_attribute": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute1": { Type: schema.TypeBool, Computed: true, }, "attribute2": { Type: schema.TypeString, Computed: true, }, }, }, }, ``` The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
… block contains only Computed attributes Reference: hashicorp/terraform-provider-aws#7198 Reference: hashicorp/terraform-provider-aws#10045 Reference: hashicorp/terraform-provider-aws#10339 Reference: hashicorp/terraform#22719 When a resource schema contains the following: ```go "config_block_attribute": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute1": { Type: schema.TypeBool, Computed: true, }, "attribute2": { Type: schema.TypeString, Computed: true, }, }, }, }, ``` The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
… block contains only Computed attributes Reference: hashicorp/terraform-provider-aws#7198 Reference: hashicorp/terraform-provider-aws#10045 Reference: hashicorp/terraform-provider-aws#10339 Reference: hashicorp/terraform#22719 When a resource schema contains the following: ```go "config_block_attribute": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute1": { Type: schema.TypeBool, Computed: true, }, "attribute2": { Type: schema.TypeString, Computed: true, }, }, }, }, ``` The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
… block contains only Computed attributes Reference: hashicorp/terraform-provider-aws#7198 Reference: hashicorp/terraform-provider-aws#10045 Reference: hashicorp/terraform-provider-aws#10339 Reference: hashicorp/terraform#22719 When a resource schema contains the following: ```go "config_block_attribute": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute1": { Type: schema.TypeBool, Computed: true, }, "attribute2": { Type: schema.TypeString, Computed: true, }, }, }, }, ``` The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
… block contains only Computed attributes Reference: hashicorp/terraform-provider-aws#7198 Reference: hashicorp/terraform-provider-aws#10045 Reference: hashicorp/terraform-provider-aws#10339 Reference: hashicorp/terraform#22719 When a resource schema contains the following: ```go "config_block_attribute": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute1": { Type: schema.TypeBool, Computed: true, }, "attribute2": { Type: schema.TypeString, Computed: true, }, }, }, }, ``` The TypeSet hash values were previously all collapsed to the zero-value, which meant that multiple set entries were lost. Here we check that all of the attributes are not just `Computed: true`. If they are all `Computed: true` attributes, ignore the check for user-defined attributes to compute the hash value.
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Terraform Version
0.11.11
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
data source should return the same amount of block devices
Actual Behavior
data source returns only one device of two
Important Factoids
Test are written incorrectly:
ebs_block_device.#
must be2
There are only two cases found. I assume there are more, and this pattern should be revised for other data sources or resources.
The text was updated successfully, but these errors were encountered: