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
}
}
}
It's a bug in the provider: https://github.com/hashicorp/terraform-provider-aws/issues/19469
The fix is merged: https://github.com/hashicorp/terraform-provider-aws/pull/19471/files#diff-30b95f9698f34518d98ef0aa482508ef13b46cb094fe2fa1133019162ceb4908R707-R709
You should wait for a new tag: https://github.com/hashicorp/terraform-provider-aws/commit/3b05635c2bb9486f5156576b3701746066aa92f8