i am creating rds server using terraform. I pass options group using list variable. The options groups variable in variable.tf like below
options = [
{
option_name = "SQLSERVER_BACKUP_RESTORE"
option_settings=[
{
name = "IAM_ROLE_ARN"
value = "${role_arn}"
},
]
},
i want replace the "${role_arn}" variable in main.tf . Can any one help with syntax ?
I solve this kind of issue using terraform template files.
Let's say that you'll need something like:
resource "provider_resource" "name" {
property = "value"
options = [
{
option_name = "SQLSERVER_BACKUP_RESTORE"
option_settings = [
{
name = "IAM_ROLE_ARN"
value = "${role_arn}"
},
]
}
]
}
after the change you will have something like:
data "template_file" "json_template" {
template = file("path/to/file.json")
vars = {
role_arn = var.dynamic_value
}
}
resource "provider_resource" "name" {
property = "value"
options = data.template_file.json_template.rendered
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With