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

service/ecs: Tagging support #6486

Merged
merged 2 commits into from
Nov 16, 2018
Merged

service/ecs: Tagging support #6486

merged 2 commits into from
Nov 16, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Nov 16, 2018

Closes #6481

aws_ecs_cluster resource refactoring was due to it not performing Read after Create.

Changes:

  • resource/aws_ecs_cluster: Add tags argument
  • resource/aws_ecs_service: Add tags argument
  • resource/aws_ecs_task_definition: Add tags argument
  • resource/aws_ecs_cluster: Refactoring to call Read after Create to ensure proper creation
  • tests/resource/aws_ecs_cluster: Add _disappears acceptance test
  • tests/resource/aws_ecs_cluster: Ensure testAccCheckAWSEcsClusterExists actually checks existence in API

Without account setting update to newer ARNs (test failure expected):

--- PASS: TestAccAWSEcsCluster_basic (11.17s)
--- PASS: TestAccAWSEcsCluster_disappears (7.16s)
--- PASS: TestAccAWSEcsCluster_Tags (26.76s)
--- PASS: TestAccAWSEcsDataSource_ecsCluster (31.49s)
--- PASS: TestAccAWSEcsDataSource_ecsContainerDefinition (41.57s)
--- PASS: TestAccAWSEcsDataSource_ecsTaskDefinition (13.08s)
--- PASS: TestAccAWSEcsService_basicImport (26.50s)
--- PASS: TestAccAWSEcsService_disappears (34.44s)
--- PASS: TestAccAWSEcsService_healthCheckGracePeriodSeconds (348.42s)
--- PASS: TestAccAWSEcsService_withAlb (389.07s)
--- PASS: TestAccAWSEcsService_withARN (48.69s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategy (40.07s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum (17.27s)
--- PASS: TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred (39.65s)
--- PASS: TestAccAWSEcsService_withDeploymentValues (16.66s)
--- PASS: TestAccAWSEcsService_withEcsClusterName (14.49s)
--- PASS: TestAccAWSEcsService_withFamilyAndRevision (46.79s)
--- PASS: TestAccAWSEcsService_withIamRole (115.51s)
--- PASS: TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration (76.90s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargate (154.78s)
--- PASS: TestAccAWSEcsService_withLbChanges (220.54s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints (41.21s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints_emptyExpression (29.47s)
--- PASS: TestAccAWSEcsService_withPlacementStrategy (78.79s)
--- PASS: TestAccAWSEcsService_withRenamedCluster (56.19s)
--- PASS: TestAccAWSEcsService_withReplicaSchedulingStrategy (40.89s)
--- PASS: TestAccAWSEcsService_withServiceRegistries (42.00s)
--- PASS: TestAccAWSEcsService_withServiceRegistries_container (50.34s)
--- PASS: TestAccAWSEcsService_withUnnormalizedPlacementStrategy (30.06s)

--- FAIL: TestAccAWSEcsService_Tags (6.57s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
          * aws_ecs_service.test: 1 error occurred:
          * aws_ecs_service.test: InvalidParameterException: The new ARN and resource ID format must be enabled to add tags to the service. Opt in to the new format and try again.

--- PASS: TestAccAWSEcsServiceDataSource_basic (42.88s)
--- PASS: TestAccAWSEcsTaskDefinition_arrays (10.51s)
--- PASS: TestAccAWSEcsTaskDefinition_basic (16.31s)
--- PASS: TestAccAWSEcsTaskDefinition_changeVolumesForcesNewResource (17.57s)
--- PASS: TestAccAWSEcsTaskDefinition_constraint (10.68s)
--- PASS: TestAccAWSEcsTaskDefinition_ExecutionRole (10.89s)
--- PASS: TestAccAWSEcsTaskDefinition_Fargate (13.56s)
--- PASS: TestAccAWSEcsTaskDefinition_Inactive (17.45s)
--- PASS: TestAccAWSEcsTaskDefinition_Tags (24.18s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolume (10.60s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolumeMinimalConfig (9.50s)
--- PASS: TestAccAWSEcsTaskDefinition_withEcsService (71.29s)
--- PASS: TestAccAWSEcsTaskDefinition_withNetworkMode (11.40s)
--- PASS: TestAccAWSEcsTaskDefinition_withScratchVolume (10.58s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskRoleArn (11.65s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskScopedDockerVolume (9.24s)

With account settings update to newer ARNs:

--- PASS: TestAccAWSEcsCluster_basic (11.24s)
--- PASS: TestAccAWSEcsCluster_disappears (6.97s)
--- PASS: TestAccAWSEcsCluster_Tags (25.11s)
--- PASS: TestAccAWSEcsDataSource_ecsCluster (41.26s)
--- PASS: TestAccAWSEcsDataSource_ecsContainerDefinition (77.07s)
--- PASS: TestAccAWSEcsDataSource_ecsTaskDefinition (13.00s)
--- PASS: TestAccAWSEcsService_basicImport (33.62s)
--- PASS: TestAccAWSEcsService_disappears (20.62s)
--- PASS: TestAccAWSEcsService_healthCheckGracePeriodSeconds (260.87s)
--- PASS: TestAccAWSEcsService_Tags (40.60s)
--- PASS: TestAccAWSEcsService_withAlb (251.52s)
--- PASS: TestAccAWSEcsService_withARN (37.32s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategy (28.73s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum (17.14s)
--- PASS: TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred (25.08s)
--- PASS: TestAccAWSEcsService_withDeploymentValues (40.52s)
--- PASS: TestAccAWSEcsService_withEcsClusterName (41.37s)
--- PASS: TestAccAWSEcsService_withFamilyAndRevision (47.26s)
--- PASS: TestAccAWSEcsService_withIamRole (131.40s)
--- PASS: TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration (85.49s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargate (157.27s)
--- PASS: TestAccAWSEcsService_withLbChanges (220.89s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints (40.17s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints_emptyExpression (75.42s)
--- PASS: TestAccAWSEcsService_withPlacementStrategy (100.87s)
--- PASS: TestAccAWSEcsService_withRenamedCluster (57.42s)
--- PASS: TestAccAWSEcsService_withReplicaSchedulingStrategy (40.44s)
--- PASS: TestAccAWSEcsService_withServiceRegistries (50.57s)
--- PASS: TestAccAWSEcsService_withServiceRegistries_container (54.97s)
--- PASS: TestAccAWSEcsService_withUnnormalizedPlacementStrategy (19.74s)
--- PASS: TestAccAWSEcsServiceDataSource_basic (34.22s)
--- PASS: TestAccAWSEcsTaskDefinition_arrays (11.26s)
--- PASS: TestAccAWSEcsTaskDefinition_basic (33.55s)
--- PASS: TestAccAWSEcsTaskDefinition_changeVolumesForcesNewResource (24.14s)
--- PASS: TestAccAWSEcsTaskDefinition_constraint (9.49s)
--- PASS: TestAccAWSEcsTaskDefinition_ExecutionRole (10.83s)
--- PASS: TestAccAWSEcsTaskDefinition_Fargate (14.78s)
--- PASS: TestAccAWSEcsTaskDefinition_Inactive (17.59s)
--- PASS: TestAccAWSEcsTaskDefinition_Tags (24.01s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolume (22.39s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolumeMinimalConfig (9.48s)
--- PASS: TestAccAWSEcsTaskDefinition_withEcsService (70.93s)
--- PASS: TestAccAWSEcsTaskDefinition_withNetworkMode (10.23s)
--- PASS: TestAccAWSEcsTaskDefinition_withScratchVolume (13.30s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskRoleArn (10.80s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskScopedDockerVolume (14.35s)

`aws_ecs_cluster` resource refactoring was due to it not performing `Read` after `Create`.

Changes:
* resource/aws_ecs_cluster: Add `tags` argument
* resource/aws_ecs_service: Add `tags` argument
* resource/aws_ecs_task_definition: Add `tags` argument
* resource/aws_ecs_cluster: Refactoring to call `Read` after `Create` to ensure proper creation
* tests/resource/aws_ecs_cluster: Add `_disappears` acceptance test
* tests/resource/aws_ecs_cluster: Ensure `testAccCheckAWSEcsClusterExists` actually checks existence in API

Without account setting update to newer ARNs (test failure expected):

```
--- PASS: TestAccAWSEcsCluster_basic (11.17s)
--- PASS: TestAccAWSEcsCluster_disappears (7.16s)
--- PASS: TestAccAWSEcsCluster_Tags (26.76s)
--- PASS: TestAccAWSEcsDataSource_ecsCluster (31.49s)
--- PASS: TestAccAWSEcsDataSource_ecsContainerDefinition (41.57s)
--- PASS: TestAccAWSEcsDataSource_ecsTaskDefinition (13.08s)
--- PASS: TestAccAWSEcsService_basicImport (26.50s)
--- PASS: TestAccAWSEcsService_disappears (34.44s)
--- PASS: TestAccAWSEcsService_healthCheckGracePeriodSeconds (348.42s)
--- PASS: TestAccAWSEcsService_withAlb (389.07s)
--- PASS: TestAccAWSEcsService_withARN (48.69s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategy (40.07s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum (17.27s)
--- PASS: TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred (39.65s)
--- PASS: TestAccAWSEcsService_withDeploymentValues (16.66s)
--- PASS: TestAccAWSEcsService_withEcsClusterName (14.49s)
--- PASS: TestAccAWSEcsService_withFamilyAndRevision (46.79s)
--- PASS: TestAccAWSEcsService_withIamRole (115.51s)
--- PASS: TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration (76.90s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargate (154.78s)
--- PASS: TestAccAWSEcsService_withLbChanges (220.54s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints (41.21s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints_emptyExpression (29.47s)
--- PASS: TestAccAWSEcsService_withPlacementStrategy (78.79s)
--- PASS: TestAccAWSEcsService_withRenamedCluster (56.19s)
--- PASS: TestAccAWSEcsService_withReplicaSchedulingStrategy (40.89s)
--- PASS: TestAccAWSEcsService_withServiceRegistries (42.00s)
--- PASS: TestAccAWSEcsService_withServiceRegistries_container (50.34s)
--- PASS: TestAccAWSEcsService_withUnnormalizedPlacementStrategy (30.06s)

--- FAIL: TestAccAWSEcsService_Tags (6.57s)
    testing.go:538: Step 0 error: Error applying: 1 error occurred:
          * aws_ecs_service.test: 1 error occurred:
          * aws_ecs_service.test: InvalidParameterException: The new ARN and resource ID format must be enabled to add tags to the service. Opt in to the new format and try again.

--- PASS: TestAccAWSEcsServiceDataSource_basic (42.88s)
--- PASS: TestAccAWSEcsTaskDefinition_arrays (10.51s)
--- PASS: TestAccAWSEcsTaskDefinition_basic (16.31s)
--- PASS: TestAccAWSEcsTaskDefinition_changeVolumesForcesNewResource (17.57s)
--- PASS: TestAccAWSEcsTaskDefinition_constraint (10.68s)
--- PASS: TestAccAWSEcsTaskDefinition_ExecutionRole (10.89s)
--- PASS: TestAccAWSEcsTaskDefinition_Fargate (13.56s)
--- PASS: TestAccAWSEcsTaskDefinition_Inactive (17.45s)
--- PASS: TestAccAWSEcsTaskDefinition_Tags (24.18s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolume (10.60s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolumeMinimalConfig (9.50s)
--- PASS: TestAccAWSEcsTaskDefinition_withEcsService (71.29s)
--- PASS: TestAccAWSEcsTaskDefinition_withNetworkMode (11.40s)
--- PASS: TestAccAWSEcsTaskDefinition_withScratchVolume (10.58s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskRoleArn (11.65s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskScopedDockerVolume (9.24s)
```

With account settings update to newer ARNs:

```
--- PASS: TestAccAWSEcsCluster_basic (11.24s)
--- PASS: TestAccAWSEcsCluster_disappears (6.97s)
--- PASS: TestAccAWSEcsCluster_Tags (25.11s)
--- PASS: TestAccAWSEcsDataSource_ecsCluster (41.26s)
--- PASS: TestAccAWSEcsDataSource_ecsContainerDefinition (77.07s)
--- PASS: TestAccAWSEcsDataSource_ecsTaskDefinition (13.00s)
--- PASS: TestAccAWSEcsService_basicImport (33.62s)
--- PASS: TestAccAWSEcsService_disappears (20.62s)
--- PASS: TestAccAWSEcsService_healthCheckGracePeriodSeconds (260.87s)
--- PASS: TestAccAWSEcsService_Tags (40.60s)
--- PASS: TestAccAWSEcsService_withAlb (251.52s)
--- PASS: TestAccAWSEcsService_withARN (37.32s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategy (28.73s)
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum (17.14s)
--- PASS: TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred (25.08s)
--- PASS: TestAccAWSEcsService_withDeploymentValues (40.52s)
--- PASS: TestAccAWSEcsService_withEcsClusterName (41.37s)
--- PASS: TestAccAWSEcsService_withFamilyAndRevision (47.26s)
--- PASS: TestAccAWSEcsService_withIamRole (131.40s)
--- PASS: TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration (85.49s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargate (157.27s)
--- PASS: TestAccAWSEcsService_withLbChanges (220.89s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints (40.17s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints_emptyExpression (75.42s)
--- PASS: TestAccAWSEcsService_withPlacementStrategy (100.87s)
--- PASS: TestAccAWSEcsService_withRenamedCluster (57.42s)
--- PASS: TestAccAWSEcsService_withReplicaSchedulingStrategy (40.44s)
--- PASS: TestAccAWSEcsService_withServiceRegistries (50.57s)
--- PASS: TestAccAWSEcsService_withServiceRegistries_container (54.97s)
--- PASS: TestAccAWSEcsService_withUnnormalizedPlacementStrategy (19.74s)
--- PASS: TestAccAWSEcsServiceDataSource_basic (34.22s)
--- PASS: TestAccAWSEcsTaskDefinition_arrays (11.26s)
--- PASS: TestAccAWSEcsTaskDefinition_basic (33.55s)
--- PASS: TestAccAWSEcsTaskDefinition_changeVolumesForcesNewResource (24.14s)
--- PASS: TestAccAWSEcsTaskDefinition_constraint (9.49s)
--- PASS: TestAccAWSEcsTaskDefinition_ExecutionRole (10.83s)
--- PASS: TestAccAWSEcsTaskDefinition_Fargate (14.78s)
--- PASS: TestAccAWSEcsTaskDefinition_Inactive (17.59s)
--- PASS: TestAccAWSEcsTaskDefinition_Tags (24.01s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolume (22.39s)
--- PASS: TestAccAWSEcsTaskDefinition_withDockerVolumeMinimalConfig (9.48s)
--- PASS: TestAccAWSEcsTaskDefinition_withEcsService (70.93s)
--- PASS: TestAccAWSEcsTaskDefinition_withNetworkMode (10.23s)
--- PASS: TestAccAWSEcsTaskDefinition_withScratchVolume (13.30s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskRoleArn (10.80s)
--- PASS: TestAccAWSEcsTaskDefinition_withTaskScopedDockerVolume (14.35s)
```
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service. labels Nov 16, 2018
@bflad bflad added this to the v1.46.0 milestone Nov 16, 2018
@bflad bflad requested a review from a team November 16, 2018 04:36
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/elasticache Issues and PRs that pertain to the elasticache service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 16, 2018
@ghost ghost added the documentation Introduces or discusses updates to documentation. label Nov 16, 2018
@mbfrahry mbfrahry self-assigned this Nov 16, 2018
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bflad bflad merged commit 6df8feb into master Nov 16, 2018
@bflad bflad deleted the f-ecs-tagging-and-arns branch November 16, 2018 16:51
bflad added a commit that referenced this pull request Nov 16, 2018
@bflad
Copy link
Contributor Author

bflad commented Nov 20, 2018

This has been released in version 1.46.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Nov 20, 2018

I believe this is an issue with AWS but I am adding here what I am experiencing.

I have opted-in (as root to default to all users) and it is working for ECS cluster and tasks but for services I am getting this error message when deploying my terraform scripts: InvalidParameterException: The new ARN and resource ID format must be enabled to add tags to the service. Opt in to the new format and try again

This is what shows in AWS console when I try to click on the tag tab in ECS:

The resource does not support tags.
Tagging requires that you opt in to the new ARN and resource ID format.

@ghost
Copy link

ghost commented Apr 2, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service. service/elasticache Issues and PRs that pertain to the elasticache service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for ECS tags
2 participants