You should be using data to fetch the full arn, not relying on parsing.
data "aws_ssm_parameter" "app_database_password" { name = "blog/DATABASE_PASSWORD" }
The reason you do this is because you cannot create an expandable JSON template file in terraform. The way you reference the variable is:
"secrets": [ { "name": "NAME_YOUR_ENV_VAR", "valueFrom": "${data.aws_ssm_parameter.app_database_password.arn}" }, ]
This is much cleaner and then you don't need to be passing around account, region, etc. You declare this much higher up.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You should be using data to fetch the full arn, not relying on parsing.
The reason you do this is because you cannot create an expandable JSON template file in terraform. The way you reference the variable is:
This is much cleaner and then you don't need to be passing around account, region, etc. You declare this much higher up.