com.pulumi.aws.cloudformation.kotlin.StackInstancesArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.cloudformation.kotlin
import com.pulumi.aws.cloudformation.StackInstancesArgs.builder
import com.pulumi.aws.cloudformation.kotlin.inputs.StackInstancesDeploymentTargetsArgs
import com.pulumi.aws.cloudformation.kotlin.inputs.StackInstancesDeploymentTargetsArgsBuilder
import com.pulumi.aws.cloudformation.kotlin.inputs.StackInstancesOperationPreferencesArgs
import com.pulumi.aws.cloudformation.kotlin.inputs.StackInstancesOperationPreferencesArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* ## Example Usage
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.cloudformation.StackInstances("example", {
* accounts: [
* "123456789012",
* "234567890123",
* ],
* regions: [
* "us-east-1",
* "us-west-2",
* ],
* stackSetName: exampleAwsCloudformationStackSet.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.cloudformation.StackInstances("example",
* accounts=[
* "123456789012",
* "234567890123",
* ],
* regions=[
* "us-east-1",
* "us-west-2",
* ],
* stack_set_name=example_aws_cloudformation_stack_set["name"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.CloudFormation.StackInstances("example", new()
* {
* Accounts = new[]
* {
* "123456789012",
* "234567890123",
* },
* Regions = new[]
* {
* "us-east-1",
* "us-west-2",
* },
* StackSetName = exampleAwsCloudformationStackSet.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudformation"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudformation.NewStackInstances(ctx, "example", &cloudformation.StackInstancesArgs{
* Accounts: pulumi.StringArray{
* pulumi.String("123456789012"),
* pulumi.String("234567890123"),
* },
* Regions: pulumi.StringArray{
* pulumi.String("us-east-1"),
* pulumi.String("us-west-2"),
* },
* StackSetName: pulumi.Any(exampleAwsCloudformationStackSet.Name),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.cloudformation.StackInstances;
* import com.pulumi.aws.cloudformation.StackInstancesArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new StackInstances("example", StackInstancesArgs.builder()
* .accounts(
* "123456789012",
* "234567890123")
* .regions(
* "us-east-1",
* "us-west-2")
* .stackSetName(exampleAwsCloudformationStackSet.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:cloudformation:StackInstances
* properties:
* accounts:
* - '123456789012'
* - '234567890123'
* regions:
* - us-east-1
* - us-west-2
* stackSetName: ${exampleAwsCloudformationStackSet.name}
* ```
*
* ### Example IAM Setup in Target Account
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy = aws.iam.getPolicyDocument({
* statements: [{
* actions: ["sts:AssumeRole"],
* effect: "Allow",
* principals: [{
* identifiers: [aWSCloudFormationStackSetAdministrationRole.arn],
* type: "AWS",
* }],
* }],
* });
* const aWSCloudFormationStackSetExecutionRole = new aws.iam.Role("AWSCloudFormationStackSetExecutionRole", {
* assumeRolePolicy: aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy.then(aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy => aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy.json),
* name: "AWSCloudFormationStackSetExecutionRole",
* });
* // Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html
* // Additional IAM permissions necessary depend on the resources defined in the StackSet template
* const aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy = aws.iam.getPolicyDocument({
* statements: [{
* actions: [
* "cloudformation:*",
* "s3:*",
* "sns:*",
* ],
* effect: "Allow",
* resources: ["*"],
* }],
* });
* const aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicyRolePolicy = new aws.iam.RolePolicy("AWSCloudFormationStackSetExecutionRole_MinimumExecutionPolicy", {
* name: "MinimumExecutionPolicy",
* policy: aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy.then(aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy => aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy.json),
* role: aWSCloudFormationStackSetExecutionRole.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* a_ws_cloud_formation_stack_set_execution_role_assume_role_policy = aws.iam.get_policy_document(statements=[{
* "actions": ["sts:AssumeRole"],
* "effect": "Allow",
* "principals": [{
* "identifiers": [a_ws_cloud_formation_stack_set_administration_role["arn"]],
* "type": "AWS",
* }],
* }])
* a_ws_cloud_formation_stack_set_execution_role = aws.iam.Role("AWSCloudFormationStackSetExecutionRole",
* assume_role_policy=a_ws_cloud_formation_stack_set_execution_role_assume_role_policy.json,
* name="AWSCloudFormationStackSetExecutionRole")
* # Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html
* # Additional IAM permissions necessary depend on the resources defined in the StackSet template
* a_ws_cloud_formation_stack_set_execution_role_minimum_execution_policy = aws.iam.get_policy_document(statements=[{
* "actions": [
* "cloudformation:*",
* "s3:*",
* "sns:*",
* ],
* "effect": "Allow",
* "resources": ["*"],
* }])
* a_ws_cloud_formation_stack_set_execution_role_minimum_execution_policy_role_policy = aws.iam.RolePolicy("AWSCloudFormationStackSetExecutionRole_MinimumExecutionPolicy",
* name="MinimumExecutionPolicy",
* policy=a_ws_cloud_formation_stack_set_execution_role_minimum_execution_policy.json,
* role=a_ws_cloud_formation_stack_set_execution_role.name)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy = Aws.Iam.GetPolicyDocument.Invoke(new()
* {
* Statements = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
* {
* Actions = new[]
* {
* "sts:AssumeRole",
* },
* Effect = "Allow",
* Principals = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
* {
* Identifiers = new[]
* {
* aWSCloudFormationStackSetAdministrationRole.Arn,
* },
* Type = "AWS",
* },
* },
* },
* },
* });
* var aWSCloudFormationStackSetExecutionRole = new Aws.Iam.Role("AWSCloudFormationStackSetExecutionRole", new()
* {
* AssumeRolePolicy = aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
* Name = "AWSCloudFormationStackSetExecutionRole",
* });
* // Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html
* // Additional IAM permissions necessary depend on the resources defined in the StackSet template
* var aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy = Aws.Iam.GetPolicyDocument.Invoke(new()
* {
* Statements = new[]
* {
* new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
* {
* Actions = new[]
* {
* "cloudformation:*",
* "s3:*",
* "sns:*",
* },
* Effect = "Allow",
* Resources = new[]
* {
* "*",
* },
* },
* },
* });
* var aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicyRolePolicy = new Aws.Iam.RolePolicy("AWSCloudFormationStackSetExecutionRole_MinimumExecutionPolicy", new()
* {
* Name = "MinimumExecutionPolicy",
* Policy = aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
* Role = aWSCloudFormationStackSetExecutionRole.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
* Statements: []iam.GetPolicyDocumentStatement{
* {
* Actions: []string{
* "sts:AssumeRole",
* },
* Effect: pulumi.StringRef("Allow"),
* Principals: []iam.GetPolicyDocumentStatementPrincipal{
* {
* Identifiers: interface{}{
* aWSCloudFormationStackSetAdministrationRole.Arn,
* },
* Type: "AWS",
* },
* },
* },
* },
* }, nil);
* if err != nil {
* return err
* }
* aWSCloudFormationStackSetExecutionRole, err := iam.NewRole(ctx, "AWSCloudFormationStackSetExecutionRole", &iam.RoleArgs{
* AssumeRolePolicy: pulumi.String(aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy.Json),
* Name: pulumi.String("AWSCloudFormationStackSetExecutionRole"),
* })
* if err != nil {
* return err
* }
* // Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html
* // Additional IAM permissions necessary depend on the resources defined in the StackSet template
* aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
* Statements: []iam.GetPolicyDocumentStatement{
* {
* Actions: []string{
* "cloudformation:*",
* "s3:*",
* "sns:*",
* },
* Effect: pulumi.StringRef("Allow"),
* Resources: []string{
* "*",
* },
* },
* },
* }, nil);
* if err != nil {
* return err
* }
* _, err = iam.NewRolePolicy(ctx, "AWSCloudFormationStackSetExecutionRole_MinimumExecutionPolicy", &iam.RolePolicyArgs{
* Name: pulumi.String("MinimumExecutionPolicy"),
* Policy: pulumi.String(aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy.Json),
* Role: aWSCloudFormationStackSetExecutionRole.Name,
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.iam.IamFunctions;
* import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
* import com.pulumi.aws.iam.Role;
* import com.pulumi.aws.iam.RoleArgs;
* import com.pulumi.aws.iam.RolePolicy;
* import com.pulumi.aws.iam.RolePolicyArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* final var aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
* .statements(GetPolicyDocumentStatementArgs.builder()
* .actions("sts:AssumeRole")
* .effect("Allow")
* .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
* .identifiers(aWSCloudFormationStackSetAdministrationRole.arn())
* .type("AWS")
* .build())
* .build())
* .build());
* var aWSCloudFormationStackSetExecutionRole = new Role("aWSCloudFormationStackSetExecutionRole", RoleArgs.builder()
* .assumeRolePolicy(aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
* .name("AWSCloudFormationStackSetExecutionRole")
* .build());
* // Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html
* // Additional IAM permissions necessary depend on the resources defined in the StackSet template
* final var aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
* .statements(GetPolicyDocumentStatementArgs.builder()
* .actions(
* "cloudformation:*",
* "s3:*",
* "sns:*")
* .effect("Allow")
* .resources("*")
* .build())
* .build());
* var aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicyRolePolicy = new RolePolicy("aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicyRolePolicy", RolePolicyArgs.builder()
* .name("MinimumExecutionPolicy")
* .policy(aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
* .role(aWSCloudFormationStackSetExecutionRole.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* aWSCloudFormationStackSetExecutionRole:
* type: aws:iam:Role
* name: AWSCloudFormationStackSetExecutionRole
* properties:
* assumeRolePolicy: ${aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy.json}
* name: AWSCloudFormationStackSetExecutionRole
* aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicyRolePolicy:
* type: aws:iam:RolePolicy
* name: AWSCloudFormationStackSetExecutionRole_MinimumExecutionPolicy
* properties:
* name: MinimumExecutionPolicy
* policy: ${aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy.json}
* role: ${aWSCloudFormationStackSetExecutionRole.name}
* variables:
* aWSCloudFormationStackSetExecutionRoleAssumeRolePolicy:
* fn::invoke:
* Function: aws:iam:getPolicyDocument
* Arguments:
* statements:
* - actions:
* - sts:AssumeRole
* effect: Allow
* principals:
* - identifiers:
* - ${aWSCloudFormationStackSetAdministrationRole.arn}
* type: AWS
* # Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html
* # Additional IAM permissions necessary depend on the resources defined in the StackSet template
* aWSCloudFormationStackSetExecutionRoleMinimumExecutionPolicy:
* fn::invoke:
* Function: aws:iam:getPolicyDocument
* Arguments:
* statements:
* - actions:
* - cloudformation:*
* - s3:*
* - sns:*
* effect: Allow
* resources:
* - '*'
* ```
*
* ### Example Deployment across Organizations account
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.cloudformation.StackInstances("example", {
* deploymentTargets: {
* organizationalUnitIds: [exampleAwsOrganizationsOrganization.roots[0].id],
* },
* regions: [
* "us-west-2",
* "us-east-1",
* ],
* stackSetName: exampleAwsCloudformationStackSet.name,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.cloudformation.StackInstances("example",
* deployment_targets={
* "organizational_unit_ids": [example_aws_organizations_organization["roots"][0]["id"]],
* },
* regions=[
* "us-west-2",
* "us-east-1",
* ],
* stack_set_name=example_aws_cloudformation_stack_set["name"])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.CloudFormation.StackInstances("example", new()
* {
* DeploymentTargets = new Aws.CloudFormation.Inputs.StackInstancesDeploymentTargetsArgs
* {
* OrganizationalUnitIds = new[]
* {
* exampleAwsOrganizationsOrganization.Roots[0].Id,
* },
* },
* Regions = new[]
* {
* "us-west-2",
* "us-east-1",
* },
* StackSetName = exampleAwsCloudformationStackSet.Name,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudformation"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := cloudformation.NewStackInstances(ctx, "example", &cloudformation.StackInstancesArgs{
* DeploymentTargets: &cloudformation.StackInstancesDeploymentTargetsArgs{
* OrganizationalUnitIds: pulumi.StringArray{
* exampleAwsOrganizationsOrganization.Roots[0].Id,
* },
* },
* Regions: pulumi.StringArray{
* pulumi.String("us-west-2"),
* pulumi.String("us-east-1"),
* },
* StackSetName: pulumi.Any(exampleAwsCloudformationStackSet.Name),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.cloudformation.StackInstances;
* import com.pulumi.aws.cloudformation.StackInstancesArgs;
* import com.pulumi.aws.cloudformation.inputs.StackInstancesDeploymentTargetsArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var example = new StackInstances("example", StackInstancesArgs.builder()
* .deploymentTargets(StackInstancesDeploymentTargetsArgs.builder()
* .organizationalUnitIds(exampleAwsOrganizationsOrganization.roots()[0].id())
* .build())
* .regions(
* "us-west-2",
* "us-east-1")
* .stackSetName(exampleAwsCloudformationStackSet.name())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:cloudformation:StackInstances
* properties:
* deploymentTargets:
* organizationalUnitIds:
* - ${exampleAwsOrganizationsOrganization.roots[0].id}
* regions:
* - us-west-2
* - us-east-1
* stackSetName: ${exampleAwsCloudformationStackSet.name}
* ```
*
* ## Import
* Import CloudFormation stack instances that target OUs, using the stack set name, `call_as`, and "OU" separated by commas (`,`). For example:
* Using `pulumi import`, import CloudFormation stack instances using the stack set name and `call_as` separated by commas (`,`). If you are importing a stack instance targeting OUs, see the example below. For example:
* ```sh
* $ pulumi import aws:cloudformation/stackInstances:StackInstances example example,SELF
* ```
* Using `pulumi import`, Import CloudFormation stack instances that target OUs, using the stack set name, `call_as`, and "OU" separated by commas (`,`). For example:
* ```sh
* $ pulumi import aws:cloudformation/stackInstances:StackInstances example example,SELF,OU
* ```
* @property accounts Accounts where you want to create stack instances in the specified `regions`. You can specify either `accounts` or `deployment_targets`, but not both.
* @property callAs Whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account. Valid values: `SELF` (default), `DELEGATED_ADMIN`.
* @property deploymentTargets AWS Organizations accounts for which to create stack instances in the `regions`. stack sets doesn't deploy stack instances to the organization management account, even if the organization management account is in your organization or in an OU in your organization. Drift detection is not possible for most of this argument. See deployment_targets below.
* @property operationPreferences Preferences for how AWS CloudFormation performs a stack set operation. See operation_preferences below.
* @property parameterOverrides Key-value map of input parameters to override from the stack set for these instances. This argument's drift detection is limited to the first account and region since each instance can have unique parameters.
* @property regions Regions where you want to create stack instances in the specified `accounts`.
* @property retainStacks Whether to remove the stack instances from the stack set, but not delete the stacks. You can't reassociate a retained stack or add an existing, saved stack to a new stack set. To retain the stack, ensure `retain_stacks = true` has been successfully applied _before_ an apply that would destroy the resource. Defaults to `false`.
* @property stackSetName Name of the stack set.
* The following arguments are optional:
*/
public data class StackInstancesArgs(
public val accounts: Output>? = null,
public val callAs: Output? = null,
public val deploymentTargets: Output? = null,
public val operationPreferences: Output? = null,
public val parameterOverrides: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy