aws_opsworks_stack

Provides an OpsWorks stack resource.

Example Usage

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
}

Argument Reference

The following arguments are supported:

  • 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.
  • default_availability_zone - (Optional) Name of the availability zone where instances will be created by default. This is required unless you set vpc_id.
  • 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_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. Mandatory if vpc_id is set, 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 mapping of tags to assign to the resource.
  • 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) The id of the VPC that this stack belongs to.
  • 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.
  • ssh_key - (Optional) SSH key to use when authenticating to the source.
  • revision - (Optional) For sources that are version-aware, the revision to use.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The id of the stack.

Import

OpsWorks stacks can be imported using the id, e.g.

$ terraform import aws_opsworks_stack.bar 00000000-0000-0000-0000-000000000000

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/opsworks_stack.html