AWS OpsWorks Stack

This page shows how to write Terraform and CloudFormation for OpsWorks Stack and write them securely.

aws_opsworks_stack (Terraform)

The Stack in OpsWorks can be configured in Terraform with the resource name aws_opsworks_stack. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

opsworks.tf#L1
resource "aws_opsworks_stack" "mainstack" {
  name                         = "php_apache2_stack"
  region                       = var.region
  vpc_id                       = aws_vpc.mainvpc.id
  default_subnet_id            = aws_subnet.public-subnet1.id
  default_os                   = "Ubuntu 14.04 LTS"
main.tf#L1
resource "aws_opsworks_stack" "control-users-ssh-on-linux" {
  name                          = var.opsworks_name
  region                        = var.opsworks_region
  service_role_arn              = var.opsworks_service_role_arn
  default_instance_profile_arn  = var.opsworks_iam_instance_profile
  color                         = var.opsworks_color
main.tf#L1
resource "aws_opsworks_stack" "main" {
  name                          = var.name
  region                        = data.aws_region.current.name
  service_role_arn              = aws_iam_role.main.arn
  default_instance_profile_arn  = aws_iam_instance_profile.ec2.arn
  agent_version                 = "LATEST"

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides an OpsWorks stack resource.

AWS::OpsWorks::Stack (CloudFormation)

The Stack in OpsWorks can be configured in CloudFormation with the resource name AWS::OpsWorks::Stack. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

Creates a new stack. For more information, see Create a New Stack. Required Permissions: To use this action, an IAM user must have an attached policy that explicitly grants permissions. For more information about user permissions, see Managing User Permissions.

Frequently asked questions

What is AWS OpsWorks Stack?

AWS OpsWorks Stack is a resource for OpsWorks of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS OpsWorks Stack?

For Terraform, the 1smii/iac_terraform_aws, ricardomessiaszup/terraform_aws_opsworks_stack and shanmugakarna/terraform-elasticsearch source code examples are useful. See the Terraform Example section for further details.