Skip to content

Terraform module for handling elastic beanstalk environment and application

License

Notifications You must be signed in to change notification settings

Flaconi/terraform-aws-beanstalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-module-template

Template for Terraform modules

lint test Tag License

Providers

Name Version
aws >= 5.0

Requirements

Name Version
terraform >= 1.3
aws >= 5.0

Required Inputs

The following input variables are required:

Description: AWS region

Type: string

Description: Short description of the Environment

Type: string

Description: ID of the VPC

Type: string

Description: List of subnets

Type: list(string)

Description: List of subnets

Type: list(string)

Description: Elastic Beanstalk stack, e.g. Docker, Go, Node, Java, IIS. For more info, see https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html

Type: string

Description: n/a

Type: string

Optional Inputs

The following input variables are optional (have default values):

Description: Availability Zone selector

Type: string

Default: "Any 3"

Description: Load Balancer type, e.g. 'application' or 'classic'

Type: string

Default: "application"

Description: Specify a security policy to apply to the listener. This option is only applicable to environments with an application load balancer

Type: string

Default: "ELBSecurityPolicy-TLS13-1-2-2021-06"

Description: Instances type

Type: string

Default: "t3.micro"

Description: The type of the EBS root volume

Type: string

Default: "gp3"

Description: The size of the EBS root volume

Type: number

Default: 10

Description: Application Health Check URL. Elastic Beanstalk will call this URL to check the health of the application running on EC2 instances

Type: string

Default: "/healthz"

Description: The interval of time, in seconds, that Elastic Load Balancing checks the health of the Amazon EC2 instances of your application

Type: number

Default: 15

Description: The amount of time, in seconds, to wait for a response during a health check. Note that this option is only applicable to environments with an application load balancer

Type: number

Default: 5

Description: For environments with enhanced health reporting enabled, whether to create a group in CloudWatch Logs for environment health and archive Elastic Beanstalk environment health data. For information about enabling enhanced health, see aws:elasticbeanstalk:healthreporting:system.

Type: bool

Default: false

Description: Whether to delete the log group when the environment is terminated. If false, the health data is kept RetentionInDays days.

Type: bool

Default: false

Description: The number of days to keep the archived health data before it expires.

Type: number

Default: 7

Description: Minumum instances to launch

Type: number

Default: 1

Description: Maximum instances to launch

Type: number

Default: 1

Description: Metric used for your Auto Scaling trigger

Type: string

Default: "CPUUtilization"

Description: Statistic the trigger should use, such as Average

Type: string

Default: "Average"

Description: Unit for the trigger measurement, such as Bytes

Type: string

Default: "Percent"

Description: Minimum level of autoscale metric to remove an instance

Type: number

Default: 20

Description: How many Amazon EC2 instances to remove when performing a scaling activity.

Type: number

Default: -1

Description: Maximum level of autoscale metric to add an instance

Type: number

Default: 80

Description: How many Amazon EC2 instances to add when performing a scaling activity

Type: number

Default: 1

Description: If more than one solution stack names is available, use the most recent solution stack.

Type: bool

Default: true

Description: Map of custom ENV variables to be provided to the application running on Elastic Beanstalk, e.g. env_vars = { DB_USER = 'admin' DB_PASS = 'xxxxxx' }

Type: map(string)

Default: {}

Description: Route53 parent zone ID. The module will create sub-domain DNS record in the parent zone for the EB environment

Type: string

Default: ""

Description: n/a

Type: string

Default: ""

Description: The subdomain to create on Route53 for the EB environment. For the subdomain to be created, the dns_zone_id variable must be set as well

Type: string

Default: ""

Description: n/a

Type: string

Default: "initial"

Description: n/a

Type: string

Default: null

Description: n/a

Type: string

Default: "Dockerrun.aws.json"

Description: n/a

Type: string

Default: null

Description: A map of additional tags to apply to all VPC resources

Type: map(string)

Default: {}

Description: n/a

Type: list(string)

Default: []

Description: n/a

Type: bool

Default: true

Description: Additional Elastic Beanstalk settings. For full list of options, see https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html

Type:

list(object({
    namespace = string
    name      = string
    value     = string
  }))

Default: []

Description: Enable managed platform updates. When you set this to true, you must also specify a PreferredStartTime and UpdateLevel

Type: bool

Default: false

Description: Configure a maintenance window for managed actions in UTC

Type: string

Default: "Sun:10:00"

Description: The highest level of update to apply with managed platform updates

Type: string

Default: "minor"

Description: Enable weekly instance replacement.

Type: bool

Default: false

Description: Whether to create groups in CloudWatch Logs for proxy and deployment logs, and stream logs from each instance in your environment

Type: bool

Default: false

Description: Whether to delete the log groups when the environment is terminated. If false, the logs are kept RetentionInDays days

Type: bool

Default: false

Description: The number of days to keep log events before they expire.

Type: number

Default: 7

Description: Name of SSH key that will be deployed on Elastic Beanstalk and DataPipeline instance. The key should be present in AWS

Type: string

Default: ""

Description: A list of Security Group rule objects to add to the created security group, in addition to the ones this module normally creates.

Type:

list(object({
    from_port   = number
    to_port     = number
    protocol    = string
    type        = string
    cidr_blocks = list(string)
    description = optional(string)
  }))

Default: []

Outputs

Name Description
elastic_beanstalk_application_name Elastic Beanstalk Application name
elastic_beanstalk_environment_application The Elastic Beanstalk Application specified for this environment
elastic_beanstalk_environment_autoscaling_groups The autoscaling groups used by this environment
elastic_beanstalk_environment_ec2_instance_profile_role_name Instance IAM role name
elastic_beanstalk_environment_elb_zone_id ELB zone id
elastic_beanstalk_environment_endpoint Fully qualified DNS name for the environment
elastic_beanstalk_environment_hostname DNS hostname
elastic_beanstalk_environment_id ID of the Elastic Beanstalk environment
elastic_beanstalk_environment_launch_configurations Launch configurations in use by this environment
elastic_beanstalk_environment_load_balancers Elastic Load Balancers in use by this environment
elastic_beanstalk_environment_log_streams Log Streaming in this environment
elastic_beanstalk_environment_name Name
elastic_beanstalk_environment_queues SQS queues in use by this environment
elastic_beanstalk_environment_security_group_arn Elastic Beanstalk environment Security Group ARN
elastic_beanstalk_environment_security_group_id Elastic Beanstalk environment Security Group ID
elastic_beanstalk_environment_security_group_name Elastic Beanstalk environment Security Group name
elastic_beanstalk_environment_tier The environment tier
elastic_beanstalk_environment_triggers Autoscaling triggers in use by this environment

License

MIT License

Copyright (c) 2022 Flaconi GmbH