Making changes to tags on a aws_secretsmanager_secret resource should not cause a problem with using the secret with a aws_secretsmanager_secret_version datasource.
Making a change to the tags of a aws_secretsmanager_secret resource is causing a problem when a aws_secretsmanager_secret_version datasource is used to access the secrets.
running "/home/atlantis/.atlantis/bin/terraform0.15.5 plan -input=false -refresh -no-color -out \"/home/atlantis/.atlantis/repos/vestwell/docker-registry/4163/default/terraform/dev.ue1/services/audit_log/dev.ue1::services::audit_log-default.tfplan\"" in "/home/atlantis/.atlantis/repos/vestwell/docker-registry/4163/default/terraform/dev.ue1/services/audit_log": exit status 1
aws_secretsmanager_secret.audit_logs_elasticsearch_terraform_credentials: Refreshing state... [id=arn:aws:secretsmanager:us-east-1:NUM:secret:audit-log-dev-elasticsearch_terraform-CREDENTIALS-EtuAUC]
...
Error: elastic: Error 401 (Unauthorized)
with elasticsearch_xpack_index_lifecycle_policy.ilm_audit_log_policy,
on elastic.tf line 109, in resource "elasticsearch_xpack_index_lifecycle_policy" "ilm_audit_log_policy":
109: resource "elasticsearch_xpack_index_lifecycle_policy" "ilm_audit_log_policy" {
This unexpected behavior does not occur in situations where a aws_secretsmanager_secret resource that does not have any tags is changed to have some tags. It occurs, so far, only if the resource has existing tags and there are changes.
Navigate into the local Kibana interface. Choose Stack Management. Create a user for Terraform to use with just all permissions to keep this simple.
Get the credential values into AWS secret manager
Execute Terraform. Confirm the Elastic Index Template was created.
Change the tags on the aws_secretsmanager_secret resource
Execute Terraform again. See the error.
Debug Output
No response
Panic Output
No response
Important Factoids
We've used a secret creation process for secrets in AWS which is sort of chicken-and-egg problem but keeps secrets out of the repo and is more-convenient for multiple teams to work with. This probably isn't a recommended way yet it isn't clear what this would have to do with tag changes.
Define the secret in Terraform as a resource
Execute Terraform to have the secret created in AWS
Update the secret in AWS with the actual values
Execute Terraform to use the secret and do the rest of the work
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Terraform Core Version
0.15.5
AWS Provider Version
4.54.0
Affected Resource(s)
aws_secretsmanager_secret
aws_secretsmanager_secret_version
Expected Behavior
Making changes to tags on a
aws_secretsmanager_secret
resource should not cause a problem with using the secret with aaws_secretsmanager_secret_version
datasource.A diff of
Should have no effect on the usage of a secret
Actual Behavior
Making a change to the tags of a
aws_secretsmanager_secret
resource is causing a problem when aaws_secretsmanager_secret_version
datasource is used to access the secrets.This unexpected behavior does not occur in situations where a
aws_secretsmanager_secret
resource that does not have any tags is changed to have some tags. It occurs, so far, only if the resource has existing tags and there are changes.Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
/data/index_templates/component/ecs/agent.json
Steps to Reproduce
You can start an Elastic stack
docker-compose.yml
Navigate into the local Kibana interface. Choose Stack Management. Create a user for Terraform to use with just all permissions to keep this simple.
Get the credential values into AWS secret manager
Execute Terraform. Confirm the Elastic Index Template was created.
Change the tags on the
aws_secretsmanager_secret
resourceExecute Terraform again. See the error.
Debug Output
No response
Panic Output
No response
Important Factoids
We've used a secret creation process for secrets in AWS which is sort of chicken-and-egg problem but keeps secrets out of the repo and is more-convenient for multiple teams to work with. This probably isn't a recommended way yet it isn't clear what this would have to do with tag changes.
resource
References
No response
Would you like to implement a fix?
No