Environment variables

We use Terraform to update the environment variables for our applications.

Edit the environment_variables-property as follows:

ECS Fargate

main.tf
module "application" {
  source = "git@github.com:BYM-IKT/terraform-byks-module.git"
  ...
  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"
  ...
  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!" will be 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.