From 5bd566ff238c7923f7e4f27eac11049057819efe Mon Sep 17 00:00:00 2001 From: Mika Linnanoja Date: Thu, 30 Jan 2025 11:20:11 +0200 Subject: [PATCH] Fix assume_role handling when role_arn is given There is a syntax error in the assume_role block with missing equals sign. As this part has anyway required newer terraform to work, document it in variable definition of role_arn input. --- templates/terraform.tf.tpl | 3 +-- variables.tf | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/templates/terraform.tf.tpl b/templates/terraform.tf.tpl index b6792d8..5ad0e94 100644 --- a/templates/terraform.tf.tpl +++ b/templates/terraform.tf.tpl @@ -8,8 +8,7 @@ terraform { profile = "${profile}" encrypt = "${encrypt}" %{~ if role_arn != "" ~} - - assume_role { + assume_role = { role_arn = "${role_arn}" } %{~ endif ~} diff --git a/variables.tf b/variables.tf index 613c898..a2c4153 100644 --- a/variables.tf +++ b/variables.tf @@ -104,7 +104,7 @@ variable "profile" { variable "role_arn" { type = string default = "" - description = "The role to be assumed" + description = "The role to be assumed. If this is set, `terraform_version` variable must be `1.6.0` or higher." } variable "terraform_backend_config_file_name" {