Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent iso-tagging precautions from eating legit errors #25549

Merged
merged 2 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions .changelog/25549.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
```release-note:bug
resource/aws_cloudwatch_composite_alarm: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_cloudwatch_metric_alarm: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_cloudwatch_metric_stream: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_ecr_repository: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
data-source/aws_ecr_repository: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_ecs_capacity_provider: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_ecs_cluster: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_ecs_service: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_ecs_task_definition: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_ecs_task_set: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_elasticache_cluster: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
data-source/aws_elasticache_cluster: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_elasticache_parameter_group: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_elasticache_replication_group: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_elasticache_subnet_group: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_elasticache_user: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_elasticache_user_group: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_lb_listener: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
data-source/aws_lb_listener: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_lb_listener_rule: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_lb: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
data-source/aws_lb: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_lb_target_group: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
data-source/aws_lb_target_group: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_cloudwatch_event_bus: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_cloudwatch_event_rule: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_instance_profile: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_openid_connect_provider: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_policy: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_role: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_saml_provider: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_server_certificate: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_service_linked_role: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_user: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_iam_virtual_mfa_device: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_sns_topic: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
resource/aws_sqs_queue: Prevent ISO-partition tagging precautions from eating legit errors
```

```release-note:bug
data-source/aws_sqs_queue: Prevent ISO-partition tagging precautions from eating legit errors
```
8 changes: 4 additions & 4 deletions internal/service/cloudwatch/composite_alarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func resourceCompositeAlarmCreate(ctx context.Context, d *schema.ResourceData, m
_, err := conn.PutCompositeAlarmWithContext(ctx, &input)

// Some partitions (i.e., ISO) may not support tag-on-create
if input.Tags != nil && verify.CheckISOErrorTagsUnsupported(err) {
if input.Tags != nil && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed creating CloudWatch Composite Alarm (%s) with tags: %s. Trying create without tags.", name, err)
input.Tags = nil

Expand All @@ -129,7 +129,7 @@ func resourceCompositeAlarmCreate(ctx context.Context, d *schema.ResourceData, m
err = UpdateTags(conn, aws.StringValue(alarm.AlarmArn), nil, tags)

// If default tags only, log and continue. Otherwise, error.
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(err) {
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed adding tags after create for CloudWatch Composite Alarm (%s): %s", d.Id(), err)
return resourceCompositeAlarmRead(ctx, d, meta)
}
Expand Down Expand Up @@ -191,7 +191,7 @@ func resourceCompositeAlarmRead(ctx context.Context, d *schema.ResourceData, met
tags, err := ListTags(conn, aws.StringValue(alarm.AlarmArn))

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed listing tags for CloudWatch Composite Alarm (%s): %s", d.Id(), err)
return nil
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func resourceCompositeAlarmUpdate(ctx context.Context, d *schema.ResourceData, m
err := UpdateTags(conn, arn, o, n)

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed updating tags for CloudWatch Composite Alarm (%s): %s", d.Id(), err)
return resourceCompositeAlarmRead(ctx, d, meta)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/service/cloudwatch/metric_alarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func resourceMetricAlarmCreate(d *schema.ResourceData, meta interface{}) error {
_, err = conn.PutMetricAlarm(&params)

// Some partitions (i.e., ISO) may not support tag-on-create
if params.Tags != nil && verify.CheckISOErrorTagsUnsupported(err) {
if params.Tags != nil && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed creating CloudWatch Metric Alarm (%s) with tags: %s. Trying create without tags.", d.Get("alarm_name").(string), err)
params.Tags = nil

Expand Down Expand Up @@ -335,7 +335,7 @@ func resourceMetricAlarmCreate(d *schema.ResourceData, meta interface{}) error {
err = UpdateTags(conn, aws.StringValue(resp.AlarmArn), nil, tags)

// If default tags only, log and continue. Otherwise, error.
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(err) {
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed adding tags after create for CloudWatch Metric Alarm (%s): %s", d.Id(), err)
return resourceMetricAlarmRead(d, meta)
}
Expand Down Expand Up @@ -430,7 +430,7 @@ func resourceMetricAlarmRead(d *schema.ResourceData, meta interface{}) error {
tags = tags.IgnoreAWS().IgnoreConfig(ignoreTagsConfig)

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed listing tags for CloudWatch Metric Alarm (%s): %s", d.Id(), err)
return nil
}
Expand Down Expand Up @@ -465,7 +465,7 @@ func resourceMetricAlarmUpdate(d *schema.ResourceData, meta interface{}) error {
err := UpdateTags(conn, arn, o, n)

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed updating tags for CloudWatch Metric Alarm (%s): %s", d.Id(), err)
return resourceMetricAlarmRead(d, meta)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/service/cloudwatch/metric_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func resourceMetricStreamCreate(ctx context.Context, d *schema.ResourceData, met
output, err := conn.PutMetricStreamWithContext(ctx, &params)

// Some partitions (i.e., ISO) may not support tag-on-create
if params.Tags != nil && verify.CheckISOErrorTagsUnsupported(err) {
if params.Tags != nil && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed creating CloudWatch Metric Stream (%s) with tags: %s. Trying create without tags.", name, err)
params.Tags = nil

Expand All @@ -222,7 +222,7 @@ func resourceMetricStreamCreate(ctx context.Context, d *schema.ResourceData, met
err := UpdateTags(conn, aws.StringValue(output.Arn), nil, tags)

// If default tags only, log and continue. Otherwise, error.
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(err) {
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed adding tags after create for CloudWatch Metric Stream (%s): %s", d.Id(), err)
return resourceMetricStreamRead(ctx, d, meta)
}
Expand Down Expand Up @@ -287,7 +287,7 @@ func resourceMetricStreamRead(ctx context.Context, d *schema.ResourceData, meta
tags, err := ListTags(conn, aws.StringValue(output.Arn))

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed listing tags for CloudWatch Metric Stream (%s): %s", d.Id(), err)
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions internal/service/ecr/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func resourceRepositoryCreate(d *schema.ResourceData, meta interface{}) error {
out, err := conn.CreateRepository(&input)

// Some partitions (i.e., ISO) may not support tag-on-create
if input.Tags != nil && meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(err) {
if input.Tags != nil && meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed creating ECR Repository (%s) with tags: %s. Trying create without tags.", d.Get("name").(string), err)
input.Tags = nil

Expand All @@ -159,7 +159,7 @@ func resourceRepositoryCreate(d *schema.ResourceData, meta interface{}) error {
err := UpdateTags(conn, aws.StringValue(repository.RepositoryArn), nil, tags)

// If default tags only, log and continue. Otherwise, error.
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(err) {
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed adding tags after create for ECR Repository (%s): %s", d.Id(), err)
return resourceRepositoryRead(d, meta)
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func resourceRepositoryRead(d *schema.ResourceData, meta interface{}) error {
tags, err := ListTags(conn, arn)

// Some partitions (i.e., ISO) may not support tagging, giving error
if meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(err) {
if meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed listing tags for ECR Repository (%s): %s", d.Id(), err)
return nil
}
Expand Down Expand Up @@ -327,7 +327,7 @@ func resourceRepositoryUpdate(d *schema.ResourceData, meta interface{}) error {
err := UpdateTags(conn, arn, o, n)

// Some partitions may not support tagging, giving error
if meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(err) {
if meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed updating tags for ECR Repository (%s): %s", d.Id(), err)
return resourceRepositoryRead(d, meta)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/ecr/repository_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func dataSourceRepositoryRead(d *schema.ResourceData, meta interface{}) error {
tags, err := ListTags(conn, arn)

// Some partitions (i.e., ISO) may not support tagging, giving error
if meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(err) {
if meta.(*conns.AWSClient).Partition != endpoints.AwsPartitionID && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed listing tags for ECR Repository (%s): %s", d.Id(), err)
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions internal/service/ecs/capacity_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func resourceCapacityProviderCreate(d *schema.ResourceData, meta interface{}) er
output, err := conn.CreateCapacityProvider(&input)

// Some partitions (i.e., ISO) may not support tag-on-create
if input.Tags != nil && verify.CheckISOErrorTagsUnsupported(err) {
if input.Tags != nil && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] ECS tagging failed creating Capacity Provider (%s) with tags: %s. Trying create without tags.", name, err)
input.Tags = nil

Expand All @@ -143,7 +143,7 @@ func resourceCapacityProviderCreate(d *schema.ResourceData, meta interface{}) er
if input.Tags == nil && len(tags) > 0 {
err := UpdateTags(conn, d.Id(), nil, tags)

if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(err) {
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
// If default tags only, log and continue. Otherwise, error.
log.Printf("[WARN] ECS tagging failed adding tags after create for Capacity Provider (%s): %s", d.Id(), err)
return resourceCapacityProviderRead(d, meta)
Expand Down Expand Up @@ -239,7 +239,7 @@ func resourceCapacityProviderUpdate(d *schema.ResourceData, meta interface{}) er
err := UpdateTags(conn, d.Id(), o, n)

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] ECS tagging failed updating tags for Capacity Provider (%s): %s", d.Id(), err)
return resourceCapacityProviderRead(d, meta)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/service/ecs/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func resourceClusterCreate(d *schema.ResourceData, meta interface{}) error {
out, err := retryClusterCreate(conn, input)

// Some partitions (i.e., ISO) may not support tag-on-create
if input.Tags != nil && verify.CheckISOErrorTagsUnsupported(err) {
if input.Tags != nil && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] ECS tagging failed creating Cluster (%s) with tags: %s. Trying create without tags.", clusterName, err)
input.Tags = nil

Expand All @@ -226,7 +226,7 @@ func resourceClusterCreate(d *schema.ResourceData, meta interface{}) error {
if input.Tags == nil && len(tags) > 0 {
err := UpdateTags(conn, d.Id(), nil, tags)

if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(err) {
if v, ok := d.GetOk("tags"); (!ok || len(v.(map[string]interface{})) == 0) && verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
// If default tags only, log and continue. Otherwise, error.
log.Printf("[WARN] ECS tagging failed adding tags after create for Cluster (%s): %s", d.Id(), err)
return resourceClusterRead(d, meta)
Expand Down Expand Up @@ -366,7 +366,7 @@ func resourceClusterUpdate(d *schema.ResourceData, meta interface{}) error {
err := UpdateTags(conn, d.Id(), o, n)

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] ECS tagging failed updating tags for Cluster (%s): %s", d.Id(), err)
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions internal/service/ecs/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func FindCapacityProviderByARN(conn *ecs.ECS, arn string) (*ecs.CapacityProvider
output, err := conn.DescribeCapacityProviders(input)

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] ECS tagging failed describing Capacity Provider (%s) with tags: %s; retrying without tags", arn, err)

input.Include = nil
Expand Down Expand Up @@ -60,15 +60,15 @@ func FindClusterByNameOrARN(ctx context.Context, conn *ecs.ECS, nameOrARN string
output, err := conn.DescribeClustersWithContext(ctx, input)

// Some partitions (i.e., ISO) may not support tagging, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed describing ECS Cluster (%s) including tags: %s; retrying without tags", nameOrARN, err)

input.Include = aws.StringSlice([]string{ecs.ClusterFieldConfigurations, ecs.ClusterFieldSettings})
output, err = conn.DescribeClustersWithContext(ctx, input)
}

// Some partitions (i.e., ISO) may not support describe including configuration, giving error
if verify.CheckISOErrorTagsUnsupported(err) {
if verify.CheckISOErrorTagsUnsupported(conn.PartitionID, err) {
log.Printf("[WARN] failed describing ECS Cluster (%s) including configuration: %s; retrying without configuration", nameOrARN, err)

input.Include = aws.StringSlice([]string{ecs.ClusterFieldSettings})
Expand Down
Loading