All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.cloudformation.kotlin.StackArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.cloudformation.kotlin

import com.pulumi.aws.cloudformation.StackArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Provides a CloudFormation Stack resource.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const network = new aws.cloudformation.Stack("network", {
 *     name: "networking-stack",
 *     parameters: {
 *         VPCCidr: "10.0.0.0/16",
 *     },
 *     templateBody: JSON.stringify({
 *         Parameters: {
 *             VPCCidr: {
 *                 Type: "String",
 *                 Default: "10.0.0.0/16",
 *                 Description: "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.",
 *             },
 *         },
 *         Resources: {
 *             myVpc: {
 *                 Type: "AWS::EC2::VPC",
 *                 Properties: {
 *                     CidrBlock: {
 *                         Ref: "VPCCidr",
 *                     },
 *                     Tags: [{
 *                         Key: "Name",
 *                         Value: "Primary_CF_VPC",
 *                     }],
 *                 },
 *             },
 *         },
 *     }),
 * });
 * ```
 * ```python
 * import pulumi
 * import json
 * import pulumi_aws as aws
 * network = aws.cloudformation.Stack("network",
 *     name="networking-stack",
 *     parameters={
 *         "VPCCidr": "10.0.0.0/16",
 *     },
 *     template_body=json.dumps({
 *         "Parameters": {
 *             "VPCCidr": {
 *                 "Type": "String",
 *                 "Default": "10.0.0.0/16",
 *                 "Description": "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.",
 *             },
 *         },
 *         "Resources": {
 *             "myVpc": {
 *                 "Type": "AWS::EC2::VPC",
 *                 "Properties": {
 *                     "CidrBlock": {
 *                         "Ref": "VPCCidr",
 *                     },
 *                     "Tags": [{
 *                         "Key": "Name",
 *                         "Value": "Primary_CF_VPC",
 *                     }],
 *                 },
 *             },
 *         },
 *     }))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using System.Text.Json;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var network = new Aws.CloudFormation.Stack("network", new()
 *     {
 *         Name = "networking-stack",
 *         Parameters =
 *         {
 *             { "VPCCidr", "10.0.0.0/16" },
 *         },
 *         TemplateBody = JsonSerializer.Serialize(new Dictionary
 *         {
 *             ["Parameters"] = new Dictionary
 *             {
 *                 ["VPCCidr"] = new Dictionary
 *                 {
 *                     ["Type"] = "String",
 *                     ["Default"] = "10.0.0.0/16",
 *                     ["Description"] = "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.",
 *                 },
 *             },
 *             ["Resources"] = new Dictionary
 *             {
 *                 ["myVpc"] = new Dictionary
 *                 {
 *                     ["Type"] = "AWS::EC2::VPC",
 *                     ["Properties"] = new Dictionary
 *                     {
 *                         ["CidrBlock"] = new Dictionary
 *                         {
 *                             ["Ref"] = "VPCCidr",
 *                         },
 *                         ["Tags"] = new[]
 *                         {
 *                             new Dictionary
 *                             {
 *                                 ["Key"] = "Name",
 *                                 ["Value"] = "Primary_CF_VPC",
 *                             },
 *                         },
 *                     },
 *                 },
 *             },
 *         }),
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"encoding/json"
 * 	"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 {
 * 		tmpJSON0, err := json.Marshal(map[string]interface{}{
 * 			"Parameters": map[string]interface{}{
 * 				"VPCCidr": map[string]interface{}{
 * 					"Type":        "String",
 * 					"Default":     "10.0.0.0/16",
 * 					"Description": "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.",
 * 				},
 * 			},
 * 			"Resources": map[string]interface{}{
 * 				"myVpc": map[string]interface{}{
 * 					"Type": "AWS::EC2::VPC",
 * 					"Properties": map[string]interface{}{
 * 						"CidrBlock": map[string]interface{}{
 * 							"Ref": "VPCCidr",
 * 						},
 * 						"Tags": []map[string]interface{}{
 * 							map[string]interface{}{
 * 								"Key":   "Name",
 * 								"Value": "Primary_CF_VPC",
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		json0 := string(tmpJSON0)
 * 		_, err = cloudformation.NewStack(ctx, "network", &cloudformation.StackArgs{
 * 			Name: pulumi.String("networking-stack"),
 * 			Parameters: pulumi.StringMap{
 * 				"VPCCidr": pulumi.String("10.0.0.0/16"),
 * 			},
 * 			TemplateBody: pulumi.String(json0),
 * 		})
 * 		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.Stack;
 * import com.pulumi.aws.cloudformation.StackArgs;
 * import static com.pulumi.codegen.internal.Serialization.*;
 * 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 network = new Stack("network", StackArgs.builder()
 *             .name("networking-stack")
 *             .parameters(Map.of("VPCCidr", "10.0.0.0/16"))
 *             .templateBody(serializeJson(
 *                 jsonObject(
 *                     jsonProperty("Parameters", jsonObject(
 *                         jsonProperty("VPCCidr", jsonObject(
 *                             jsonProperty("Type", "String"),
 *                             jsonProperty("Default", "10.0.0.0/16"),
 *                             jsonProperty("Description", "Enter the CIDR block for the VPC. Default is 10.0.0.0/16.")
 *                         ))
 *                     )),
 *                     jsonProperty("Resources", jsonObject(
 *                         jsonProperty("myVpc", jsonObject(
 *                             jsonProperty("Type", "AWS::EC2::VPC"),
 *                             jsonProperty("Properties", jsonObject(
 *                                 jsonProperty("CidrBlock", jsonObject(
 *                                     jsonProperty("Ref", "VPCCidr")
 *                                 )),
 *                                 jsonProperty("Tags", jsonArray(jsonObject(
 *                                     jsonProperty("Key", "Name"),
 *                                     jsonProperty("Value", "Primary_CF_VPC")
 *                                 )))
 *                             ))
 *                         ))
 *                     ))
 *                 )))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   network:
 *     type: aws:cloudformation:Stack
 *     properties:
 *       name: networking-stack
 *       parameters:
 *         VPCCidr: 10.0.0.0/16
 *       templateBody:
 *         fn::toJSON:
 *           Parameters:
 *             VPCCidr:
 *               Type: String
 *               Default: 10.0.0.0/16
 *               Description: Enter the CIDR block for the VPC. Default is 10.0.0.0/16.
 *           Resources:
 *             myVpc:
 *               Type: AWS::EC2::VPC
 *               Properties:
 *                 CidrBlock:
 *                   Ref: VPCCidr
 *                 Tags:
 *                   - Key: Name
 *                     Value: Primary_CF_VPC
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import Cloudformation Stacks using the `name`. For example:
 * ```sh
 * $ pulumi import aws:cloudformation/stack:Stack stack networking-stack
 * ```
 * @property capabilities A list of capabilities.
 * Valid values: `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, or `CAPABILITY_AUTO_EXPAND`
 * @property disableRollback Set to true to disable rollback of the stack if stack creation failed.
 * Conflicts with `on_failure`.
 * @property iamRoleArn The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
 * @property name Stack name.
 * @property notificationArns A list of SNS topic ARNs to publish stack related events.
 * @property onFailure Action to be taken if stack creation fails. This must be
 * one of: `DO_NOTHING`, `ROLLBACK`, or `DELETE`. Conflicts with `disable_rollback`.
 * @property parameters A map of Parameter structures that specify input parameters for the stack.
 * @property policyBody Structure containing the stack policy body.
 * Conflicts w/ `policy_url`.
 * @property policyUrl Location of a file containing the stack policy.
 * Conflicts w/ `policy_body`.
 * @property tags Map of resource tags to associate with this stack. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
 * @property templateBody Structure containing the template body (max size: 51,200 bytes).
 * @property templateUrl Location of a file containing the template body (max size: 460,800 bytes).
 * @property timeoutInMinutes The amount of time that can pass before the stack status becomes `CREATE_FAILED`.
 */
public data class StackArgs(
    public val capabilities: Output>? = null,
    public val disableRollback: Output? = null,
    public val iamRoleArn: Output? = null,
    public val name: Output? = null,
    public val notificationArns: Output>? = null,
    public val onFailure: Output? = null,
    public val parameters: Output>? = null,
    public val policyBody: Output? = null,
    public val policyUrl: Output? = null,
    public val tags: Output>? = null,
    public val templateBody: Output? = null,
    public val templateUrl: Output? = null,
    public val timeoutInMinutes: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.cloudformation.StackArgs =
        com.pulumi.aws.cloudformation.StackArgs.builder()
            .capabilities(capabilities?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .disableRollback(disableRollback?.applyValue({ args0 -> args0 }))
            .iamRoleArn(iamRoleArn?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .notificationArns(notificationArns?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .onFailure(onFailure?.applyValue({ args0 -> args0 }))
            .parameters(
                parameters?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .policyBody(policyBody?.applyValue({ args0 -> args0 }))
            .policyUrl(policyUrl?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .templateBody(templateBody?.applyValue({ args0 -> args0 }))
            .templateUrl(templateUrl?.applyValue({ args0 -> args0 }))
            .timeoutInMinutes(timeoutInMinutes?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [StackArgs].
 */
@PulumiTagMarker
public class StackArgsBuilder internal constructor() {
    private var capabilities: Output>? = null

    private var disableRollback: Output? = null

    private var iamRoleArn: Output? = null

    private var name: Output? = null

    private var notificationArns: Output>? = null

    private var onFailure: Output? = null

    private var parameters: Output>? = null

    private var policyBody: Output? = null

    private var policyUrl: Output? = null

    private var tags: Output>? = null

    private var templateBody: Output? = null

    private var templateUrl: Output? = null

    private var timeoutInMinutes: Output? = null

    /**
     * @param value A list of capabilities.
     * Valid values: `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, or `CAPABILITY_AUTO_EXPAND`
     */
    @JvmName("tpvuwdltllunofed")
    public suspend fun capabilities(`value`: Output>) {
        this.capabilities = value
    }

    @JvmName("giolrpkhqaywmaqe")
    public suspend fun capabilities(vararg values: Output) {
        this.capabilities = Output.all(values.asList())
    }

    /**
     * @param values A list of capabilities.
     * Valid values: `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, or `CAPABILITY_AUTO_EXPAND`
     */
    @JvmName("xlfsruopbsemutkl")
    public suspend fun capabilities(values: List>) {
        this.capabilities = Output.all(values)
    }

    /**
     * @param value Set to true to disable rollback of the stack if stack creation failed.
     * Conflicts with `on_failure`.
     */
    @JvmName("gddbficawkpkulnp")
    public suspend fun disableRollback(`value`: Output) {
        this.disableRollback = value
    }

    /**
     * @param value The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
     */
    @JvmName("hfpilssyuajlirxv")
    public suspend fun iamRoleArn(`value`: Output) {
        this.iamRoleArn = value
    }

    /**
     * @param value Stack name.
     */
    @JvmName("gbroermrgksjxxtu")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value A list of SNS topic ARNs to publish stack related events.
     */
    @JvmName("juamgwnqggfrykri")
    public suspend fun notificationArns(`value`: Output>) {
        this.notificationArns = value
    }

    @JvmName("dpyrgeuqffgopjjv")
    public suspend fun notificationArns(vararg values: Output) {
        this.notificationArns = Output.all(values.asList())
    }

    /**
     * @param values A list of SNS topic ARNs to publish stack related events.
     */
    @JvmName("hxivxxpubshtmruf")
    public suspend fun notificationArns(values: List>) {
        this.notificationArns = Output.all(values)
    }

    /**
     * @param value Action to be taken if stack creation fails. This must be
     * one of: `DO_NOTHING`, `ROLLBACK`, or `DELETE`. Conflicts with `disable_rollback`.
     */
    @JvmName("kvfrqtqbtsuywiwn")
    public suspend fun onFailure(`value`: Output) {
        this.onFailure = value
    }

    /**
     * @param value A map of Parameter structures that specify input parameters for the stack.
     */
    @JvmName("bmlqtalnjsydyxmb")
    public suspend fun parameters(`value`: Output>) {
        this.parameters = value
    }

    /**
     * @param value Structure containing the stack policy body.
     * Conflicts w/ `policy_url`.
     */
    @JvmName("vshapyqujyvwvpnl")
    public suspend fun policyBody(`value`: Output) {
        this.policyBody = value
    }

    /**
     * @param value Location of a file containing the stack policy.
     * Conflicts w/ `policy_body`.
     */
    @JvmName("hdfhoemhfnpxbaqd")
    public suspend fun policyUrl(`value`: Output) {
        this.policyUrl = value
    }

    /**
     * @param value Map of resource tags to associate with this stack. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("paucrwllgnmftwir")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Structure containing the template body (max size: 51,200 bytes).
     */
    @JvmName("gqsafodwmeajnxup")
    public suspend fun templateBody(`value`: Output) {
        this.templateBody = value
    }

    /**
     * @param value Location of a file containing the template body (max size: 460,800 bytes).
     */
    @JvmName("muebntuemwaovycc")
    public suspend fun templateUrl(`value`: Output) {
        this.templateUrl = value
    }

    /**
     * @param value The amount of time that can pass before the stack status becomes `CREATE_FAILED`.
     */
    @JvmName("bikaphpmcomcjxdw")
    public suspend fun timeoutInMinutes(`value`: Output) {
        this.timeoutInMinutes = value
    }

    /**
     * @param value A list of capabilities.
     * Valid values: `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, or `CAPABILITY_AUTO_EXPAND`
     */
    @JvmName("ghmysfhloudvaecg")
    public suspend fun capabilities(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.capabilities = mapped
    }

    /**
     * @param values A list of capabilities.
     * Valid values: `CAPABILITY_IAM`, `CAPABILITY_NAMED_IAM`, or `CAPABILITY_AUTO_EXPAND`
     */
    @JvmName("osfaacmlumgqqejv")
    public suspend fun capabilities(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.capabilities = mapped
    }

    /**
     * @param value Set to true to disable rollback of the stack if stack creation failed.
     * Conflicts with `on_failure`.
     */
    @JvmName("oeejxuewmulgkmls")
    public suspend fun disableRollback(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.disableRollback = mapped
    }

    /**
     * @param value The ARN of an IAM role that AWS CloudFormation assumes to create the stack. If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
     */
    @JvmName("bjcjkoudqljoaclb")
    public suspend fun iamRoleArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.iamRoleArn = mapped
    }

    /**
     * @param value Stack name.
     */
    @JvmName("drobutaogoqdwekh")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value A list of SNS topic ARNs to publish stack related events.
     */
    @JvmName("sjoyplijanwwwvil")
    public suspend fun notificationArns(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.notificationArns = mapped
    }

    /**
     * @param values A list of SNS topic ARNs to publish stack related events.
     */
    @JvmName("gucdmhjjepwtevjv")
    public suspend fun notificationArns(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.notificationArns = mapped
    }

    /**
     * @param value Action to be taken if stack creation fails. This must be
     * one of: `DO_NOTHING`, `ROLLBACK`, or `DELETE`. Conflicts with `disable_rollback`.
     */
    @JvmName("bqxtkejewjxpoggy")
    public suspend fun onFailure(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.onFailure = mapped
    }

    /**
     * @param value A map of Parameter structures that specify input parameters for the stack.
     */
    @JvmName("cbxqeoqyibvyswec")
    public suspend fun parameters(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.parameters = mapped
    }

    /**
     * @param values A map of Parameter structures that specify input parameters for the stack.
     */
    @JvmName("shikhtsbqrdiehag")
    public fun parameters(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.parameters = mapped
    }

    /**
     * @param value Structure containing the stack policy body.
     * Conflicts w/ `policy_url`.
     */
    @JvmName("bjnmrewqeaspilfk")
    public suspend fun policyBody(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.policyBody = mapped
    }

    /**
     * @param value Location of a file containing the stack policy.
     * Conflicts w/ `policy_body`.
     */
    @JvmName("dwusotwlbherwknd")
    public suspend fun policyUrl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.policyUrl = mapped
    }

    /**
     * @param value Map of resource tags to associate with this stack. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("mmnfggrstqmcbxbi")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values Map of resource tags to associate with this stack. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("tsetvcwdexdnajoq")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Structure containing the template body (max size: 51,200 bytes).
     */
    @JvmName("igpymfkaaouhkqst")
    public suspend fun templateBody(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.templateBody = mapped
    }

    /**
     * @param value Location of a file containing the template body (max size: 460,800 bytes).
     */
    @JvmName("jldendjsljyrwjth")
    public suspend fun templateUrl(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.templateUrl = mapped
    }

    /**
     * @param value The amount of time that can pass before the stack status becomes `CREATE_FAILED`.
     */
    @JvmName("qfovbcsxldekryou")
    public suspend fun timeoutInMinutes(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.timeoutInMinutes = mapped
    }

    internal fun build(): StackArgs = StackArgs(
        capabilities = capabilities,
        disableRollback = disableRollback,
        iamRoleArn = iamRoleArn,
        name = name,
        notificationArns = notificationArns,
        onFailure = onFailure,
        parameters = parameters,
        policyBody = policyBody,
        policyUrl = policyUrl,
        tags = tags,
        templateBody = templateBody,
        templateUrl = templateUrl,
        timeoutInMinutes = timeoutInMinutes,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy