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

com.pulumi.aws.ecs.kotlin.CapacityProviderArgs.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.ecs.kotlin

import com.pulumi.aws.ecs.CapacityProviderArgs.builder
import com.pulumi.aws.ecs.kotlin.inputs.CapacityProviderAutoScalingGroupProviderArgs
import com.pulumi.aws.ecs.kotlin.inputs.CapacityProviderAutoScalingGroupProviderArgsBuilder
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.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Provides an ECS cluster capacity provider. More information can be found on the [ECS Developer Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html).
 * > **NOTE:** Associating an ECS Capacity Provider to an Auto Scaling Group will automatically add the `AmazonECSManaged` tag to the Auto Scaling Group. This tag should be included in the `aws.autoscaling.Group` resource configuration to prevent the provider from removing it in subsequent executions as well as ensuring the `AmazonECSManaged` tag is propagated to all EC2 Instances in the Auto Scaling Group if `min_size` is above 0 on creation. Any EC2 Instances in the Auto Scaling Group without this tag must be manually be updated, otherwise they may cause unexpected scaling behavior and metrics.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const test = new aws.autoscaling.Group("test", {tags: [{
 *     key: "AmazonECSManaged",
 *     value: "true",
 *     propagateAtLaunch: true,
 * }]});
 * const testCapacityProvider = new aws.ecs.CapacityProvider("test", {
 *     name: "test",
 *     autoScalingGroupProvider: {
 *         autoScalingGroupArn: test.arn,
 *         managedTerminationProtection: "ENABLED",
 *         managedScaling: {
 *             maximumScalingStepSize: 1000,
 *             minimumScalingStepSize: 1,
 *             status: "ENABLED",
 *             targetCapacity: 10,
 *         },
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * test = aws.autoscaling.Group("test", tags=[{
 *     "key": "AmazonECSManaged",
 *     "value": "true",
 *     "propagate_at_launch": True,
 * }])
 * test_capacity_provider = aws.ecs.CapacityProvider("test",
 *     name="test",
 *     auto_scaling_group_provider={
 *         "auto_scaling_group_arn": test.arn,
 *         "managed_termination_protection": "ENABLED",
 *         "managed_scaling": {
 *             "maximum_scaling_step_size": 1000,
 *             "minimum_scaling_step_size": 1,
 *             "status": "ENABLED",
 *             "target_capacity": 10,
 *         },
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var test = new Aws.AutoScaling.Group("test", new()
 *     {
 *         Tags = new[]
 *         {
 *             new Aws.AutoScaling.Inputs.GroupTagArgs
 *             {
 *                 Key = "AmazonECSManaged",
 *                 Value = "true",
 *                 PropagateAtLaunch = true,
 *             },
 *         },
 *     });
 *     var testCapacityProvider = new Aws.Ecs.CapacityProvider("test", new()
 *     {
 *         Name = "test",
 *         AutoScalingGroupProvider = new Aws.Ecs.Inputs.CapacityProviderAutoScalingGroupProviderArgs
 *         {
 *             AutoScalingGroupArn = test.Arn,
 *             ManagedTerminationProtection = "ENABLED",
 *             ManagedScaling = new Aws.Ecs.Inputs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs
 *             {
 *                 MaximumScalingStepSize = 1000,
 *                 MinimumScalingStepSize = 1,
 *                 Status = "ENABLED",
 *                 TargetCapacity = 10,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ecs"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		test, err := autoscaling.NewGroup(ctx, "test", &autoscaling.GroupArgs{
 * 			Tags: autoscaling.GroupTagArray{
 * 				&autoscaling.GroupTagArgs{
 * 					Key:               pulumi.String("AmazonECSManaged"),
 * 					Value:             pulumi.String("true"),
 * 					PropagateAtLaunch: pulumi.Bool(true),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = ecs.NewCapacityProvider(ctx, "test", &ecs.CapacityProviderArgs{
 * 			Name: pulumi.String("test"),
 * 			AutoScalingGroupProvider: &ecs.CapacityProviderAutoScalingGroupProviderArgs{
 * 				AutoScalingGroupArn:          test.Arn,
 * 				ManagedTerminationProtection: pulumi.String("ENABLED"),
 * 				ManagedScaling: &ecs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs{
 * 					MaximumScalingStepSize: pulumi.Int(1000),
 * 					MinimumScalingStepSize: pulumi.Int(1),
 * 					Status:                 pulumi.String("ENABLED"),
 * 					TargetCapacity:         pulumi.Int(10),
 * 				},
 * 			},
 * 		})
 * 		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.autoscaling.Group;
 * import com.pulumi.aws.autoscaling.GroupArgs;
 * import com.pulumi.aws.autoscaling.inputs.GroupTagArgs;
 * import com.pulumi.aws.ecs.CapacityProvider;
 * import com.pulumi.aws.ecs.CapacityProviderArgs;
 * import com.pulumi.aws.ecs.inputs.CapacityProviderAutoScalingGroupProviderArgs;
 * import com.pulumi.aws.ecs.inputs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs;
 * 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 test = new Group("test", GroupArgs.builder()
 *             .tags(GroupTagArgs.builder()
 *                 .key("AmazonECSManaged")
 *                 .value(true)
 *                 .propagateAtLaunch(true)
 *                 .build())
 *             .build());
 *         var testCapacityProvider = new CapacityProvider("testCapacityProvider", CapacityProviderArgs.builder()
 *             .name("test")
 *             .autoScalingGroupProvider(CapacityProviderAutoScalingGroupProviderArgs.builder()
 *                 .autoScalingGroupArn(test.arn())
 *                 .managedTerminationProtection("ENABLED")
 *                 .managedScaling(CapacityProviderAutoScalingGroupProviderManagedScalingArgs.builder()
 *                     .maximumScalingStepSize(1000)
 *                     .minimumScalingStepSize(1)
 *                     .status("ENABLED")
 *                     .targetCapacity(10)
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   test:
 *     type: aws:autoscaling:Group
 *     properties:
 *       tags:
 *         - key: AmazonECSManaged
 *           value: true
 *           propagateAtLaunch: true
 *   testCapacityProvider:
 *     type: aws:ecs:CapacityProvider
 *     name: test
 *     properties:
 *       name: test
 *       autoScalingGroupProvider:
 *         autoScalingGroupArn: ${test.arn}
 *         managedTerminationProtection: ENABLED
 *         managedScaling:
 *           maximumScalingStepSize: 1000
 *           minimumScalingStepSize: 1
 *           status: ENABLED
 *           targetCapacity: 10
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import ECS Capacity Providers using the `name`. For example:
 * ```sh
 * $ pulumi import aws:ecs/capacityProvider:CapacityProvider example example
 * ```
 * @property autoScalingGroupProvider Configuration block for the provider for the ECS auto scaling group. Detailed below.
 * @property name Name of the capacity provider.
 * @property tags Key-value map of resource tags. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
 */
public data class CapacityProviderArgs(
    public val autoScalingGroupProvider: Output? = null,
    public val name: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.ecs.CapacityProviderArgs =
        com.pulumi.aws.ecs.CapacityProviderArgs.builder()
            .autoScalingGroupProvider(
                autoScalingGroupProvider?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [CapacityProviderArgs].
 */
@PulumiTagMarker
public class CapacityProviderArgsBuilder internal constructor() {
    private var autoScalingGroupProvider: Output? = null

    private var name: Output? = null

    private var tags: Output>? = null

    /**
     * @param value Configuration block for the provider for the ECS auto scaling group. Detailed below.
     */
    @JvmName("qsknifdyosiyvoet")
    public suspend fun autoScalingGroupProvider(`value`: Output) {
        this.autoScalingGroupProvider = value
    }

    /**
     * @param value Name of the capacity provider.
     */
    @JvmName("ywcnnkuwqvxyavqj")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

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

    /**
     * @param value Configuration block for the provider for the ECS auto scaling group. Detailed below.
     */
    @JvmName("erwkamsqkymgsnrm")
    public suspend fun autoScalingGroupProvider(`value`: CapacityProviderAutoScalingGroupProviderArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.autoScalingGroupProvider = mapped
    }

    /**
     * @param argument Configuration block for the provider for the ECS auto scaling group. Detailed below.
     */
    @JvmName("vbrgipjroujngrux")
    public suspend fun autoScalingGroupProvider(argument: suspend CapacityProviderAutoScalingGroupProviderArgsBuilder.() -> Unit) {
        val toBeMapped = CapacityProviderAutoScalingGroupProviderArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.autoScalingGroupProvider = mapped
    }

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

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

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

    internal fun build(): CapacityProviderArgs = CapacityProviderArgs(
        autoScalingGroupProvider = autoScalingGroupProvider,
        name = name,
        tags = tags,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy