After we create a secret and secret version using terraform once we try to fetch the data from that secret the error "Secrets Manager can't find the specified secret value for staging label: AWSCURRENT" pop's for us, but once we try to verify the secret using AWS cli the label AWSCURRENT is present there.
Here the terraform Code:
resource "aws_secretsmanager_secret" "secrets" {
name = "secrets"
recovery_window_in_days = 0
}
resource "aws_secretsmanager_secret_version" "secrets-version" {
secret_id = aws_secretsmanager_secret.secrets.id
secret_string = jsonencode(var.secrets)
version_stages = ["AWSCURRENT"]
}
Here the output from AWS CLI over that secret
{
"ARN": "arn:aws:secretsmanager:us-east-1:1111111111111:secret:secrets-bRFXt2",
"Name": "secrets",
"LastChangedDate": "2022-09-30T15:22:28.070000-03:00",
"LastAccessedDate": "2022-10-02T21:00:00-03:00",
"Tags": [],
"VersionIdsToStages": {
"aa6fd140-0648-4e5c-a69d-33dd5d7bcc6e": [
"AWSCURRENT"
]
},
"CreatedDate": "2022-09-30T15:22:28.026000-03:00"
}
I understand that the secret have the correct label attached as showed before, but once we try to work with it, that's the error that Pop's.
Secrets Manager can't find the specified secret value for staging label: AWSCURRENT
Any idea what could be wrong here?