Provides an Elastic Beanstalk Environment Resource. Elastic Beanstalk allows you to deploy and manage applications in the AWS cloud without worrying about the infrastructure that runs those applications.
Environments are often things such as development
, integration
, or
production
.
resource "aws_elastic_beanstalk_application" "tftest" {
name = "tf-test-name"
description = "tf-test-desc"
}
resource "aws_elastic_beanstalk_environment" "tfenvtest" {
name = "tf-test-name"
application = aws_elastic_beanstalk_application.tftest.name
solution_stack_name = "64bit Amazon Linux 2015.03 v2.0.3 running Go 1.4"
}
This resource supports the following arguments:
name
- (Required) A unique name for this Environment. This name is used
in the application URLapplication
– (Required) Name of the application that contains the version
to be deployedcname_prefix
- (Optional) Prefix to use for the fully qualified DNS name of
the Environment.description
- (Optional) Short description of the Environmenttier
- (Optional) Elastic Beanstalk Environment tier. Valid values are Worker
or WebServer
. If tier is left blank WebServer
will be used.setting
– (Optional) Option settings to configure the new Environment. These
override specific values that are set as defaults. The format is detailed
below in Option Settingssolution_stack_name
– (Optional) A solution stack to base your environment
off of. Example stacks can be found in the Amazon API documentationtemplate_name
– (Optional) The name of the Elastic Beanstalk Configuration
template to use in deploymentplatform_arn
– (Optional) The ARN of the Elastic Beanstalk Platform
to use in deploymentwait_for_ready_timeout
- (Default 20m
) The maximum
duration that Terraform should
wait for an Elastic Beanstalk Environment to be in a ready state before timing
out.poll_interval
– The time between polling the AWS API to
check if changes have been applied. Use this to adjust the rate of API calls
for any create
or update
action. Minimum 10s
, maximum 180s
. Omit this to
use the default behavior, which is an exponential backoffversion_label
- (Optional) The name of the Elastic Beanstalk Application Version
to use in deployment.tags
- (Optional) A set of tags to apply to the Environment. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.Some options can be stack-specific, check AWS Docs for supported options and examples.
The setting
and all_settings
mappings support the following format:
namespace
- unique namespace identifying the option's associated AWS resourcename
- name of the configuration optionvalue
- value for the configuration optionresource
- (Optional) resource name for scheduled actionresource "aws_elastic_beanstalk_application" "tftest" {
name = "tf-test-name"
description = "tf-test-desc"
}
resource "aws_elastic_beanstalk_environment" "tfenvtest" {
name = "tf-test-name"
application = aws_elastic_beanstalk_application.tftest.name
solution_stack_name = "64bit Amazon Linux 2015.03 v2.0.3 running Go 1.4"
setting {
namespace = "aws:ec2:vpc"
name = "VPCId"
value = "vpc-xxxxxxxx"
}
setting {
namespace = "aws:ec2:vpc"
name = "Subnets"
value = "subnet-xxxxxxxx"
}
}
This resource exports the following attributes in addition to the arguments above:
id
- ID of the Elastic Beanstalk Environment.name
- Name of the Elastic Beanstalk Environment.description
- Description of the Elastic Beanstalk Environment.tier
- The environment tier specified.tags_all
- A map of tags assigned to the resource, including those inherited from the provider default_tags
configuration block.application
– The Elastic Beanstalk Application specified for this environment.setting
– Settings specifically set for this Environment.all_settings
– List of all option settings configured in this Environment. These
are a combination of default settings and their overrides from setting
in
the configuration.cname
- Fully qualified DNS name for this Environment.autoscaling_groups
- The autoscaling groups used by this Environment.instances
- Instances used by this Environment.launch_configurations
- Launch configurations in use by this Environment.load_balancers
- Elastic load balancers in use by this Environment.queues
- SQS queues in use by this Environment.triggers
- Autoscaling triggers in use by this Environment.endpoint_url
- The URL to the Load Balancer for this EnvironmentIn Terraform v1.5.0 and later, use an import
block to import Elastic Beanstalk Environments using the id
. For example:
import {
to = aws_elastic_beanstalk_environment.prodenv
id = "e-rpqsewtp2j"
}
Using terraform import
, import Elastic Beanstalk Environments using the id
. For example:
% terraform import aws_elastic_beanstalk_environment.prodenv e-rpqsewtp2j