The AWS::ElasticBeanstalk::Application resource specifies an Elastic Beanstalk 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"
}
}
]
})
}
application_name
(String) A name for the Elastic Beanstalk application. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the application name.description
(String) Your description of the application.resource_lifecycle_config
(Attributes) Specifies an application resource lifecycle configuration to prevent your application from accumulating too many versions. (see below for nested schema)id
(String) Uniquely identifies the resource.resource_lifecycle_config
Optional:
service_role
(String) The ARN of an IAM service role that Elastic Beanstalk has permission to assume. The ServiceRole property is required the first time that you provide a ResourceLifecycleConfig for the application. After you provide it once, Elastic Beanstalk persists the Service Role with the application, and you don't need to specify it again. You can, however, specify it in subsequent updates to change the Service Role to another value.version_lifecycle_config
(Attributes) Defines lifecycle settings for application versions. (see below for nested schema)resource_lifecycle_config.version_lifecycle_config
Optional:
max_age_rule
(Attributes) Specify a max age rule to restrict the length of time that application versions are retained for an application. (see below for nested schema)max_count_rule
(Attributes) Specify a max count rule to restrict the number of application versions that are retained for an application. (see below for nested schema)resource_lifecycle_config.version_lifecycle_config.max_age_rule
Optional:
delete_source_from_s3
(Boolean) Set to true to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.enabled
(Boolean) Specify true to apply the rule, or false to disable it.max_age_in_days
(Number) Specify the number of days to retain an application versions.resource_lifecycle_config.version_lifecycle_config.max_count_rule
Optional:
delete_source_from_s3
(Boolean) Set to true to delete a version's source bundle from Amazon S3 when Elastic Beanstalk deletes the application version.enabled
(Boolean) Specify true to apply the rule, or false to disable it.max_count
(Number) Specify the maximum number of application versions to retain.Import is supported using the following syntax:
$ terraform import awscc_elasticbeanstalk_application.example <resource ID>