awscc_elasticbeanstalk_application (Resource)

The AWS::ElasticBeanstalk::Application resource specifies an Elastic Beanstalk application.

Example Usage

Create a sample AWS ElasticBeanstalk application.

In this example we create a sample elasticbeanstalk application with an application version lifecycle setting enabled. The lifecycle rule is set for maximum application version count wherein the oldest application version would be deleted once the number of application versions exceeds max_count value. The application version would not be deleted from the source S3 bucket.

resource "awscc_elasticbeanstalk_application" "example" {
  application_name = "SampleAWSElasticBeanstalkApplication"
  description      = "AWS Elastic Beanstalk PHP sample Application."
  resource_lifecycle_config = {
    service_role = awscc_iam_role.elasticbeanstalk_servicerole.arn
    version_lifecycle_config = {
      max_count_rule = {
        enabled               = true
        delete_source_from_s3 = false
        max_count             = 50
      }
    }
  }
}

resource "awscc_iam_role" "elasticbeanstalk_servicerole" {
  role_name           = "elasticbeanstalk-custom-service-role"
  description         = "This is a service role for ElasticBeanstalk"
  managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth", "arn:aws:iam::aws:policy/AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy"]
  assume_role_policy_document = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Action = "sts:AssumeRole"
        Effect = "Allow"
        Sid    = ""
        Principal = {
          Service = "elasticbeanstalk.amazonaws.com"
        }
      }
    ]

  })
}

Schema

Optional

Read-Only

Nested Schema for resource_lifecycle_config

Optional:

Nested Schema for resource_lifecycle_config.version_lifecycle_config

Optional:

Nested Schema for resource_lifecycle_config.version_lifecycle_config.max_age_rule

Optional:

Nested Schema for resource_lifecycle_config.version_lifecycle_config.max_count_rule

Optional:

Import

Import is supported using the following syntax:

$ terraform import awscc_elasticbeanstalk_application.example <resource ID>