Skip to content

Environment variables

Terraform is used to update environment variables for applications.

Edit the environment_variables-property as follows:

ECS Fargate

main.tf
module "application" {
  source = "git@github.com:BYM-IKT/terraform-byks-module.git?ref=v12"
  ...
  ecs_services = {
    kattehotell-service = {
      ...
      environment_variables = {
        MESSAGE_TEXT = "Hello world!"
      }
    }
  }
}

Lambda

main.tf
module "application" {
  source = "git@github.com:BYM-IKT/terraform-byks-module.git?ref=v12"
  ...
  lambda_functions = {
    kattehotell-booking = {
      ...
      environment_variables = {
        MESSAGE_TEXT = "Hello world!"
      }
    }
  }
}

Create a Pull Request to Terraform apply this change. After this change has been applied, the environment variable MESSAGE_TEXT with the value "Hello world!" is available in your application.

You can verify this by checking the ECS task definition or Lambda configuration in the AWS Console, or by logging the variable in your application.