Terraform-provider-aws: Create stack set instances using a single operation on the stack set

Created on 20 Dec 2019  路  3Comments  路  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Currently there is a resource_aws_cloudformation_stack_set_instance resource. The problem with this resource is that it can only create a stack set instance in one account at a time. The next problem is that stack set can only handle one operation at a time. This means that if you need to create 5 stack set instances using the same stack set, that you will have to disable parallelism for your entire terraform project. Or add dependencies between the stack set instances. Both are not desirable, we have over 30 accounts.

The AWS API, however, supports multiple account ids when creating stack set instances. I'm a bit confused as to why this was implemented with a single account id and not multiple account ids.

New or Affected Resource(s)

Allow the use of multiple account ids with the resource_aws_cloudformation_stack_set_instance resource or create a new resource resource_aws_cloudformation_stack_set_instances.

  • resource_aws_cloudformation_stack_set_instance

Potential Terraform Configuration

resource "aws_cloudformation_stack_set_instance" "backupplan_setup_stack" {
  account_ids     = ["123141241", "123124214", "35235234"]
  stack_set_name = var.aws_backupplan_setup_stack_set_name
  region         = "eu-west-1"
}

References

  • 10969

  • enhancement needs-triage serviccloudformation

    Most helpful comment

    An additional idea would be to support Organizational Units as well, as this is being supported in the AWS api as well.

    All 3 comments

    An additional idea would be to support Organizational Units as well, as this is being supported in the AWS api as well.

    I would be good with just the organization unit support

    There is way, you can use "for_each" for multiple accounts

    resource "aws_cloudformation_stack_set_instance" "config_instance"{
    for_each = local.aws_accounts
    account_id = each.value
    region = "us-east-1"
    stack_set_name = aws_cloudformation_stack_set.config.name
    }

    Was this page helpful?
    0 / 5 - 0 ratings