Open gdessie opened 1 week ago
Voting for Prioritization
Volunteering to Work on This Issue
Hey @gdessie 👋 Thank you for taking the time to raise this! I took a quick look to verify that the aws_dynamodb_table.id
was being set as documented. Depending on exactly how things are configured, that happens either here or here (where tableName
is created here). I also took some time to review the changelog, and didn't see anything that would give me the indication that this has changed in the versions between 1.57.x
and the current version of the provider.
Was the aws_dynamodb_table
imported to the new state during the migration? I'd be curious as to what that resource looks like in the state, and what value is being set for var.table_name
, since that's what is being used for aws_dynamodb_table.table.name
. Are you able to provide debug logging (redacted as needed) in case that information is helpful for whoever winds up picking this up to look into it more?
Hey @justinretzolk thanks for taking a look at this! Started seeing this issue when I tried to import the table from another repo that's configured with newer terraform and provider versions than the source repo. Here's what the state looks like (var.name
is set to the name of my table). I shared the plan output under "Relevant Error/Panic Output Snippet" section but let me know if there's more I can provide.
"name": "table",
"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]",
"instances": [
{
"schema_version": 1,
"attributes": {
"arn": "arn:aws:dynamodb:<region>:<account-id>:table/<table-name>",
"billing_mode": "PROVISIONED",
"deletion_protection_enabled": true,
"global_secondary_index": [],
"hash_key": "pk",
"id": "arn:aws:dynamodb:<region>:<account-id>:table/<table-name>",
"import_table": [],
"local_secondary_index": [],
"name": "<table-name>",
"point_in_time_recovery": [
{
"enabled": true
}
],
"range_key": "sk",
"read_capacity": 200,
"replica": [],
"restore_date_time": null,
"restore_source_name": null,
"restore_to_latest_time": null,
"server_side_encryption": [
{
"enabled": true,
"kms_key_arn": "arn:aws:kms:<region>:<account-id>:key/<key-id>"
}
],
"stream_arn": "",
"stream_enabled": false,
"stream_label": "",
"stream_view_type": "KEYS_ONLY",
"table_class": "STANDARD",
"timeouts": {
"create": "10m",
"delete": "10m",
"update": "10m"
},
"ttl": [
{
"attribute_name": "ttl",
"enabled": true
}
],
"write_capacity": xxx
}
}
]
*yes the table was imported as well
Thanks for the additional context @gdessie! Unfortunately I don't have a solid answer for what's changed there at the moment -- I'll leave that for whoever picks this up to work on it.
In the meantime, based on the state output, it looks like you should be able to update your configuration from "table/${aws_dynamodb_table.table.id}"
to "table/${aws_dynamodb_table.table.name}"
to workaround this and retain the implicit dependency.
Yeah, I already did that by replacing a shared module with a local copy of it. I am trying to follow best practices at work :) Thanks for your time, @justinretzolk!
Terraform Core Version
0.11.10
AWS Provider Version
1.57.x
Affected Resource(s)
I have a DynamoDB table created with terraform version
0.11.10
& provider1.57.x
but I have upgraded them to0.15.5
&4.0
a while back. Now I am trying to move the state from this repo to another one configured with the latest provider version and terraform1.3
. I'm not sure what's causing the issue but terraform is trying to recreate appautoscaling resources because the output from the table resource has unexpected values. I have also recreated the issue when I tried to remove the resource and import again in the same repository.Expected Behavior
The
id
from the table output should be the name of the table (as documented here)Actual Behavior
ARN of the table is being set on the id output.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None