From 69b733f1a0f1f3bff1d9568addfcaa588d8c3360 Mon Sep 17 00:00:00 2001 From: Roberth Kulbin <6707630+roberth-k@users.noreply.github.com> Date: Wed, 26 Jan 2022 23:43:39 +0000 Subject: [PATCH 1/2] r/aws_ecs_cluster: deprecate the capacity_providers & default_capacity_provider_strategy attributes --- internal/service/ecs/cluster.go | 14 +++++----- website/docs/r/ecs_cluster.html.markdown | 34 +++++++++++++++++++++--- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/internal/service/ecs/cluster.go b/internal/service/ecs/cluster.go index e5c724d218e..2c55af6c764 100644 --- a/internal/service/ecs/cluster.go +++ b/internal/service/ecs/cluster.go @@ -50,9 +50,10 @@ func ResourceCluster() *schema.Resource { Computed: true, }, "capacity_providers": { - Type: schema.TypeSet, - Optional: true, - Computed: true, + Type: schema.TypeSet, + Optional: true, + Computed: true, + Deprecated: "Use the aws_ecs_cluster_capacity_providers resource instead", Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -114,9 +115,10 @@ func ResourceCluster() *schema.Resource { }, }, "default_capacity_provider_strategy": { - Type: schema.TypeSet, - Optional: true, - Computed: true, + Type: schema.TypeSet, + Optional: true, + Computed: true, + Deprecated: "Use the aws_ecs_cluster_capacity_providers resource instead", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "base": { diff --git a/website/docs/r/ecs_cluster.html.markdown b/website/docs/r/ecs_cluster.html.markdown index 82830183fca..651cb3508b7 100644 --- a/website/docs/r/ecs_cluster.html.markdown +++ b/website/docs/r/ecs_cluster.html.markdown @@ -25,7 +25,7 @@ resource "aws_ecs_cluster" "foo" { } ``` -## Example W/Log Configuration +### Example with Log Configuration ```terraform resource "aws_kms_key" "example" { @@ -54,13 +54,41 @@ resource "aws_ecs_cluster" "test" { } ``` +### Example with Capacity Providers + +```terraform +resource "aws_ecs_cluster" "example" { + name = "example" +} + +resource "aws_ecs_cluster_capacity_providers" "example" { + cluster_name = aws_ecs_cluster.example.name + + capacity_providers = [aws_ecs_capacity_provider.example.name] + + default_capacity_provider_strategy { + base = 1 + weight = 100 + capacity_provider = aws_ecs_capacity_provider.example.name + } +} + +resource "aws_ecs_capacity_provider" "example" { + name = "example" + + auto_scaling_group_provider { + auto_scaling_group_arn = aws_autoscaling_group.example.arn + } +} +``` + ## Argument Reference The following arguments are supported: -* `capacity_providers` - (Optional) List of short names of one or more capacity providers to associate with the cluster. Valid values also include `FARGATE` and `FARGATE_SPOT`. +* `capacity_providers` - (Optional, **Deprecated** use the `aws_ecs_cluster_capacity_providers` resource instead) List of short names of one or more capacity providers to associate with the cluster. Valid values also include `FARGATE` and `FARGATE_SPOT`. * `configuration` - (Optional) The execute command configuration for the cluster. Detailed below. -* `default_capacity_provider_strategy` - (Optional) Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below. +* `default_capacity_provider_strategy` - (Optional, **Deprecated** use the `aws_ecs_cluster_capacity_providers` resource instead) Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below. * `name` - (Required) Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) * `setting` - (Optional) Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below. * `tags` - (Optional) Key-value map of resource tags. If configured with a provider [`default_tags` configuration block](https://www.terraform.io/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. From d2364940d8a9c8731d65fe355b2657020f17b57d Mon Sep 17 00:00:00 2001 From: Roberth Kulbin <6707630+roberth-k@users.noreply.github.com> Date: Wed, 26 Jan 2022 23:50:06 +0000 Subject: [PATCH 2/2] add changelog entry for #22783 --- .changelog/22783.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/22783.txt diff --git a/.changelog/22783.txt b/.changelog/22783.txt new file mode 100644 index 00000000000..708224b486f --- /dev/null +++ b/.changelog/22783.txt @@ -0,0 +1,3 @@ +```release-note:note +resource/aws_ecs_cluster: The `capacity_providers` and `default_capacity_provider_strategy` arguments have been deprecated. Use the `aws_ecs_cluster_capacity_providers` resource instead. + ```