Open ronanbarrett opened 2 months ago
Voting for Prioritization
Volunteering to Work on This Issue
Hey @ronanbarrett 👋 Thank you for taking the time to raise this! I'm reviewing this issue while triaging, and wanted to offer a potential workaround until this is able to be prioritized and more thoroughly addressed. You should be able to add bucket
, organization
, password
, and username
to ignore_changes
and prevent this from occurring. It might also be worth reviewing your logs to see what's being returned for data.aws_secretsmanager_secret_version.influx-current
and compare that to the logging for the aws_timestreaminfluxdb_db_instance
resource.
If you're able to supply debug logging (redacted as needed), that may also help whoever ultimately picks this up to look into it.
Thanks @justinretzolk I have added the lifecycle rule as follows and it imports without destroying the resource 👍
lifecycle {
ignore_changes = [
username,
password,
organization,
bucket
]
}
I can confirm that I had already tried setting the organization, username, password, bucket attributes to the literal string values they already has (not going via the secret) and terraform was still suggesting the destructive action. So it is still a bug.
The problem is that aws_timestreaminfluxdb_db_instance
solely uses the AWS SDK for Go and never uses the InfluxDB v2 API. username
, password
, organization
, and bucket
are required when creating the instance by the AWS SDK for Go but there are no AWS SDK for Go methods that allow the reading of these values. These values can only be read from the instance using the InfluxDB v2 API.
A workaround I added, intially, was to read from the secret that is created when the instance is created (internal/service/timestreaminfluxdb/db_instance.go line 529). This secret will contain the username
, password
, organization
, and bucket
values. However, this change was removed when the PR was merged, I'm not sure why.
Terraform Core Version
1.8.1
AWS Provider Version
5.65.0
Affected Resource(s)
Expected Behavior
It should be possible to import an existing AWS Timestream Influx DB database without it being recreated and losing all the data in the database.
Actual Behavior
The terraform plan makes it clear after importing the resource the database will be destroyed and then recreated.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Debug Output
No response
Panic Output
No response
Important Factoids
The fields organization, username, password, bucket are all marked as required so removing them is not an option.
The values I'm assigning to organization, username, password, bucket are the string values currently assigned to them.
References
PR that introduced support for the resource https://github.com/hashicorp/terraform-provider-aws/issues/36398
Would you like to implement a fix?
None