AWS App Runner does not see runtime_environment_variables from Terraform module

865 Views Asked by At

Using Terraform with module aws_apprunner_service I'm creating AWS App Runner service. According to documentation I should be able to pass env variables as map.

In my case Service is created fine, but no any runtime_environment_variables are passed to App Runner. All the others variables provided by AWS are present.

App Runner does not have panel for env variables, so I listed all available using NodeJS and console log console.log(process.env)

Creating App Runner from AWS console and adding variables works correctly and I can see all default variables and also my custom variables.

My configuration of module

resource "aws_apprunner_service" "apprunner" {
  service_name = var.name
  source_configuration {
    authentication_configuration {
      access_role_arn = var.role_arn
    }
    image_repository {
      image_configuration {
        port = var.port
        runtime_environment_variables = {
          "test" = "xxx"
        }
      }
      image_identifier = var.image
      image_repository_type = var.repository_type
    }
  }
}
1

There are 1 best solutions below