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
[Bug]: Getting empty KMS key for DynamoDB replica #37335
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
To follow up @dobriSu's information, I think what's going on here is that when The kicker for this, is that when the replica's description field isn't populated, the provider assumes that the key is nil. It follows up with a request to determine more information about the replica ( |
diff --git a/internal/service/dynamodb/table_replica.go b/internal/service/dynamodb/table_replica.go
index 92e8fa3b90..838818d9bc 100644
--- a/internal/service/dynamodb/table_replica.go
+++ b/internal/service/dynamodb/table_replica.go
@@ -297,6 +297,12 @@ func resourceTableReplicaReadReplica(ctx context.Context, d *schema.ResourceData
return create.AppendDiagError(diags, names.DynamoDB, create.ErrActionReading, resNameTableReplica, d.Id(), fmt.Errorf("continuous backups: %w", err))
}
+ if d.Get(names.AttrKMSKeyARN) == nil {
+ if table.SSEDescription.KMSMasterKeyArn != nil {
+ d.Set(names.AttrKMSKeyARN, table.SSEDescription.KMSMasterKeyArn)
+ }
+ }
+
if pitrOut != nil && pitrOut.ContinuousBackupsDescription != nil && pitrOut.ContinuousBackupsDescription.PointInTimeRecoveryDescription != nil {
d.Set("point_in_time_recovery", pitrOut.ContinuousBackupsDescription.PointInTimeRecoveryDescription.PointInTimeRecoveryStatus == awstypes.PointInTimeRecoveryStatusEnabled)
} else { This might work, but there aren't any existing import tests I could utilise for inspiration to test it. |
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
This functionality has been released in v5.51.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
Terraform Core Version
v1.5.7,v1.8.1
AWS Provider Version
5.48.0,5.12.0
Affected Resource(s)
aws_dynamodb_table_replica
Expected Behavior
terraform import aws_dynamodb_table_replica.table_name_region TableName:<main_replica_region>
should import dynamoDB replica for region with KMS key.
Actual Behavior
terraform import aws_dynamodb_table_replica.table_name_region TableName:<main_replica_region>
sometime import dynamoDB replica without empty KMS key.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
N/A
Steps to Reproduce
Debug Output
Panic Output
No response
Important Factoids
Probably it was caused by not guaranteed respond from AWS on DynamoDB tables DescribeTable output.
It is not documented but this is what I get from AWS Support:
References
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: