-
Notifications
You must be signed in to change notification settings - Fork 233
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 Source with Unstable id Attribute and Unconfigured Default Attribute Showing Difference Every Apply #586
Comments
This may require disallowing defaults in data sources through the legacy SDK. It doesn't necessarily mean that there can't be a future mechanism for providing defaults within the provider itself, but they can't be sent back to Terraform through the returned value unless the attribute is The general pain of data sources showing up in the plan is something that should only exist through the 0.13 core release cycle. The 0.14 release will no longer have a separate Refresh phase, and data sources will always be read once with the complete, udpate-to-date configuration. It doesn't mean that this issue should be ignored, since we would prefer to be able to someday enforce correctness of the returned values, rather than only log inconsistencies as warnings. |
I think a lot of this was resolved with fixing unstable attributes in the AWS provider and Terraform CLI has changed immensely since this issue was opened. If there's still reason to track anything, it might be best to open a new issue with a reproduction case using more recent versions of CLI and the SDK. |
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. |
SDK version
Relevant provider source code
Important notes:
d.SetId()
value (I have not verified if stabilizing theid
attribute makes the overall difference go away.)max_keys
attributeDefault: 1000
(non-zero-value; although issue does apply to zero-valueDefault
as well)d.Set("max_keys", /*...*/)
Terraform Configuration Files
Debug Output
Likely relevant output:
Expected Behavior
No data source difference shown:
Actual Behavior
The unstable data source
id
attribute issue, new in Terraform 0.13.0, is tracked here:Terraform 0.13.1 contained a fix to hide the data source difference if the unstable
id
attribute was the only difference. However, later versions still show this issue when combined with another attribute that has aDefault
. Somewhere along the line, core or the SDK is not honoring theComputed
-ness ofDefault
.Steps to Reproduce
This configuration is chosen because the setup is quick/easy to replicate and the data source contains a non-zero-value
Default
. More typical in the AWS Provider isType: schema.TypeBool
attributes withDefault: false
that also have this issue.The configuration above is self-contained for Terraform 0.13 reproduction, which requires the
depends_on
. If you would like to test against Terraform 0.12, comment out thedepends_on
in the data source otherwise 0.12 will show a perpetual difference anyways due to how data sources previously interacted with the graph.You can also bring your own S3 bucket with some objects, if you wish to see this occurring without the resource -> data source references. Just comment out the resources and adjust the data source configuration.
terraform init
terraform apply
terraform apply
References
aws_acm_certificate
data source: Data Source: aws_acm_certificate flagging up change to id field on every run terraform-provider-aws#15199id
attribute handling: Data sources with non-deterministic IDs show perpetual diff with Terraform 0.13 (R015, R016, R017 linters) terraform-provider-aws#14579id
attribute) only handling: Ability to Get/Set Only the State Resource Identifier (Without id Attribute Handling) #541id
attribute) only handling: helper/schema: Introduce ResourceData GetResourceId and SetResourceId receiver methods and only passthrough id attribute state if present #542depends_on
until 0.14): Implicit Reference Ordering with Data Sources in 0.13 terraform#25961The text was updated successfully, but these errors were encountered: