Skip to content

Commit

Permalink
Merge pull request #22783 from roberth-k/f-aws_ecs_cluster-capacity-p…
Browse files Browse the repository at this point in the history
…roviders-deprecation

r/aws_ecs_cluster: deprecate capacity provider attributes
  • Loading branch information
ewbankkit committed Jan 27, 2022
2 parents c76e0f4 + d236494 commit 3ea0d21
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .changelog/22783.txt
Original file line number Diff line number Diff line change
@@ -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.
```
14 changes: 8 additions & 6 deletions internal/service/ecs/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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": {
Expand Down
34 changes: 31 additions & 3 deletions website/docs/r/ecs_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "aws_ecs_cluster" "foo" {
}
```

## Example W/Log Configuration
### Example with Log Configuration

```terraform
resource "aws_kms_key" "example" {
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3ea0d21

Please sign in to comment.