former2 icon indicating copy to clipboard operation
former2 copied to clipboard

terraform resource aws_secretsmanager_secret_version generated incorrect output

Open rorourke-iot opened this issue 1 year ago • 1 comments

The resource for an AWS secret was generated as

resource "aws_secretsmanager_secret" "SecretsManagerSecret" {
    name = "mySecret-XXX"
    description = "IAM Access Key Secret"
    tags = {}
}

resource "aws_secretsmanager_secret_version" "SecretsManagerSecretVersion" {
    secret_id = "arn:aws:secretsmanager:us-east-1:794459195369:secret:mySecret-XXX-YYY"
    secret_string = "<secrete string>"
}

When using this to apply a plan, the output included the message: Error: putting Secrets Manager Secret value: ResourceNotFoundException: Secrets Manager can't find the specified secret. According to the docs, the value for secret_id is best represented as aws_secretsmanager_secret.SecretsManagerSecret.id.

rorourke-iot avatar May 17 '23 15:05 rorourke-iot

Hi @rorourke-iot,

Thanks for raising. I've added an extra attribute mapping that should hopefully reference the secret_id as you say. Let me know how that goes for you.

iann0036 avatar May 19 '23 23:05 iann0036