Provides an OpsWorks stack resource.
resource "aws_opsworks_stack" "main" {
name = "awesome-stack"
region = "us-west-1"
service_role_arn = aws_iam_role.opsworks.arn
default_instance_profile_arn = aws_iam_instance_profile.opsworks.arn
tags = {
Name = "foobar-terraform-stack"
}
custom_json = <<EOT
{
"foobar": {
"version": "1.0.0"
}
}
EOT
}
This resource supports the following arguments:
name
- (Required) The name of the stack.region
- (Required) The name of the region where the stack will exist.service_role_arn
- (Required) The ARN of an IAM role that the OpsWorks service will act as.default_instance_profile_arn
- (Required) The ARN of an IAM Instance Profile that created instances will have by default.agent_version
- (Optional) If set to "LATEST"
, OpsWorks will automatically install the latest version.berkshelf_version
- (Optional) If manage_berkshelf
is enabled, the version of Berkshelf to use.color
- (Optional) Color to paint next to the stack's resources in the OpsWorks console.configuration_manager_name
- (Optional) Name of the configuration manager to use. Defaults to "Chef".configuration_manager_version
- (Optional) Version of the configuration manager to use. Defaults to "11.4".custom_cookbooks_source
- (Optional) When use_custom_cookbooks
is set, provide this sub-object as described below.custom_json
- (Optional) User defined JSON passed to "Chef". Use a "here doc" for multiline JSON.default_availability_zone
- (Optional) Name of the availability zone where instances will be created by default.
Cannot be set when vpc_id
is set.default_os
- (Optional) Name of OS that will be installed on instances by default.default_root_device_type
- (Optional) Name of the type of root device instances will have by default.default_ssh_key_name
- (Optional) Name of the SSH keypair that instances will have by default.default_subnet_id
- (Optional) ID of the subnet in which instances will be created by default.
Required if vpc_id
is set to a VPC other than the default VPC, and forbidden if it isn't.hostname_theme
- (Optional) Keyword representing the naming scheme that will be used for instance hostnames within this stack.manage_berkshelf
- (Optional) Boolean value controlling whether Opsworks will run Berkshelf for this stack.tags
- (Optional) A map of tags to assign to the resource.
If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.use_custom_cookbooks
- (Optional) Boolean value controlling whether the custom cookbook settings are enabled.use_opsworks_security_groups
- (Optional) Boolean value controlling whether the standard OpsWorks security groups apply to created instances.vpc_id
- (Optional) ID of the VPC that this stack belongs to.
Defaults to the region's default VPC.custom_json
- (Optional) Custom JSON attributes to apply to the entire stack.The custom_cookbooks_source
block supports the following arguments:
type
- (Required) The type of source to use. For example, "archive".url
- (Required) The URL where the cookbooks resource can be found.username
- (Optional) Username to use when authenticating to the source.password
- (Optional) Password to use when authenticating to the source. Terraform cannot perform drift detection of this configuration.ssh_key
- (Optional) SSH key to use when authenticating to the source. Terraform cannot perform drift detection of this configuration.revision
- (Optional) For sources that are version-aware, the revision to use.This resource exports the following attributes in addition to the arguments above:
id
- The id of the stack.tags_all
- A map of tags assigned to the resource, including those inherited from the provider default_tags
configuration block.In Terraform v1.5.0 and later, use an import
block to import OpsWorks stacks using the id
. For example:
import {
to = aws_opsworks_stack.bar
id = "00000000-0000-0000-0000-000000000000"
}
Using terraform import
, import OpsWorks stacks using the id
. For example:
% terraform import aws_opsworks_stack.bar 00000000-0000-0000-0000-000000000000