|
| 1 | +/** |
| 2 | + * #  SSM ParameterStore parameters |
| 3 | + * |
| 4 | + * Purpose: Configure parameters in AWS SSM ParameterStore |
| 5 | + */ |
| 6 | +resource "aws_ssm_parameter" "parameters" { |
| 7 | + count = length(var.parameters) |
| 8 | + name = var.context != null ? "/${var.context}/${lookup(var.parameters[count.index], "name")}" : lookup(var.parameters[count.index], "name") |
| 9 | + value = lookup(var.parameters[count.index], "value") |
| 10 | + description = lookup(var.parameters[count.index], "description") != null ? lookup(var.parameters[count.index], "description") : null |
| 11 | + type = "String" |
| 12 | + overwrite = var.overwrite |
| 13 | + allowed_pattern = var.allowed_pattern |
| 14 | + data_type = var.data_type |
| 15 | + |
| 16 | + tags = { |
| 17 | + Context = var.context |
| 18 | + } |
| 19 | +} |
| 20 | + |
| 21 | +resource "aws_ssm_parameter" "list_params" { |
| 22 | + count = length(var.list_params) |
| 23 | + name = var.context != null ? "/${var.context}/${lookup(var.list_params[count.index], "name")}" : lookup(var.list_params[count.index], "name") |
| 24 | + value = lookup(var.list_params[count.index], "value") |
| 25 | + description = lookup(var.list_params[count.index], "description") != null ? lookup(var.list_params[count.index], "description") : null |
| 26 | + type = "String" |
| 27 | + overwrite = var.overwrite |
| 28 | + allowed_pattern = var.allowed_pattern |
| 29 | + data_type = var.data_type |
| 30 | + |
| 31 | + tags = { |
| 32 | + Context = var.context |
| 33 | + } |
| 34 | +} |
| 35 | + |
| 36 | +resource "aws_ssm_parameter" "secure_params" { |
| 37 | + count = length(var.secure_params) |
| 38 | + name = var.context != null ? "/${var.context}/${lookup(var.parameters[count.index], "name")}" : lookup(var.secure_params[count.index], "name") |
| 39 | + value = lookup(var.secure_params[count.index], "value") |
| 40 | + description = lookup(var.secure_params[count.index], "description") != null ? lookup(var.secure_params[count.index], "description") : null |
| 41 | + type = "SecureString" |
| 42 | + overwrite = var.overwrite |
| 43 | + allowed_pattern = var.allowed_pattern |
| 44 | + data_type = var.data_type |
| 45 | + key_id = var.key_id |
| 46 | + |
| 47 | + tags = { |
| 48 | + Context = var.context |
| 49 | + } |
| 50 | +} |
0 commit comments