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

r/aws_ecs_task_definition: Restore container_definitions serialization fidelity #38804

Merged

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Aug 9, 2024

Description

Restores v5.58.0 (and before) JSON serialization fidelity for aws_ecs_task_definition.container_definitions by reaching into the AWS SDK for Go v2 and using its serializer.

Relations

Closes #38782.

Output from Acceptance Testing

Before

% make testacc TESTARGS='-run=TestAccECSTaskDefinition_containerDefinitionDockerLabels' PKG=ecs
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/ecs/... -v -count 1 -parallel 20  -run=TestAccECSTaskDefinition_containerDefinitionDockerLabels -timeout 360m
=== RUN   TestAccECSTaskDefinition_containerDefinitionDockerLabels
=== PAUSE TestAccECSTaskDefinition_containerDefinitionDockerLabels
=== CONT  TestAccECSTaskDefinition_containerDefinitionDockerLabels
    task_definition_test.go:1347: Step 1/1 error: Check failed: Check 3/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'PROMETHEUS_EXPORTER_JOB_NAME')" expected "true", got "false"
        Check 4/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "[0].dockerLabels.PROMETHEUS_EXPORTER_JOB_NAME" got "<nil>" (<nil>)
        Check 5/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'PROMETHEUS_EXPORTER_PATH')" expected "true", got "false"
        Check 6/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "[0].dockerLabels.PROMETHEUS_EXPORTER_PATH" got "<nil>" (<nil>)
        Check 7/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'PROMETHEUS_EXPORTER_PORT')" expected "true", got "false"
        Check 8/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "[0].dockerLabels.PROMETHEUS_EXPORTER_PORT" got "<nil>" (<nil>)
        Check 9/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'PROMETHEUS_TARGET')" expected "true", got "false"
        Check 10/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "[0].dockerLabels.PROMETHEUS_TARGET" got "<nil>" (<nil>)
        Check 11/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'pROMETHEUS_EXPORTER_JOB_NAME')" expected "false", got "true"
        Check 12/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'pROMETHEUS_EXPORTER_PATH')" expected "false", got "true"
        Check 13/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'pROMETHEUS_EXPORTER_PORT')" expected "false", got "true"
        Check 14/15 error: aws_ecs_task_definition.test: Attribute "container_definitions", JMESPath "keys([0].dockerLabels) | contains(@, 'pROMETHEUS_TARGET')" expected "false", got "true"
--- FAIL: TestAccECSTaskDefinition_containerDefinitionDockerLabels (6.23s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ecs	11.074s
FAIL
make: *** [testacc] Error 1

After

% make testacc TESTARGS='-run=TestAccECSTaskDefinition_' PKG=ecs ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/ecs/... -v -count 1 -parallel 3  -run=TestAccECSTaskDefinition_ -timeout 360m
=== RUN   TestAccECSTaskDefinition_basic
=== PAUSE TestAccECSTaskDefinition_basic
=== RUN   TestAccECSTaskDefinition_scratchVolume
=== PAUSE TestAccECSTaskDefinition_scratchVolume
=== RUN   TestAccECSTaskDefinition_configuredAtLaunch
=== PAUSE TestAccECSTaskDefinition_configuredAtLaunch
=== RUN   TestAccECSTaskDefinition_DockerVolume_basic
=== PAUSE TestAccECSTaskDefinition_DockerVolume_basic
=== RUN   TestAccECSTaskDefinition_DockerVolume_minimal
=== PAUSE TestAccECSTaskDefinition_DockerVolume_minimal
=== RUN   TestAccECSTaskDefinition_runtimePlatform
=== PAUSE TestAccECSTaskDefinition_runtimePlatform
=== RUN   TestAccECSTaskDefinition_Fargate_runtimePlatform
=== PAUSE TestAccECSTaskDefinition_Fargate_runtimePlatform
=== RUN   TestAccECSTaskDefinition_Fargate_runtimePlatformWithoutArch
=== PAUSE TestAccECSTaskDefinition_Fargate_runtimePlatformWithoutArch
=== RUN   TestAccECSTaskDefinition_EFSVolume_minimal
=== PAUSE TestAccECSTaskDefinition_EFSVolume_minimal
=== RUN   TestAccECSTaskDefinition_EFSVolume_basic
=== PAUSE TestAccECSTaskDefinition_EFSVolume_basic
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryption
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryption
=== RUN   TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
=== PAUSE TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
=== RUN   TestAccECSTaskDefinition_EFSVolume_accessPoint
=== PAUSE TestAccECSTaskDefinition_EFSVolume_accessPoint
=== RUN   TestAccECSTaskDefinition_fsxWinFileSystem
=== PAUSE TestAccECSTaskDefinition_fsxWinFileSystem
=== RUN   TestAccECSTaskDefinition_DockerVolume_taskScoped
=== PAUSE TestAccECSTaskDefinition_DockerVolume_taskScoped
=== RUN   TestAccECSTaskDefinition_service
=== PAUSE TestAccECSTaskDefinition_service
=== RUN   TestAccECSTaskDefinition_taskRoleARN
=== PAUSE TestAccECSTaskDefinition_taskRoleARN
=== RUN   TestAccECSTaskDefinition_networkMode
=== PAUSE TestAccECSTaskDefinition_networkMode
=== RUN   TestAccECSTaskDefinition_ipcMode
=== PAUSE TestAccECSTaskDefinition_ipcMode
=== RUN   TestAccECSTaskDefinition_pidMode
=== PAUSE TestAccECSTaskDefinition_pidMode
=== RUN   TestAccECSTaskDefinition_constraint
=== PAUSE TestAccECSTaskDefinition_constraint
=== RUN   TestAccECSTaskDefinition_changeVolumesForcesNewResource
=== PAUSE TestAccECSTaskDefinition_changeVolumesForcesNewResource
=== RUN   TestAccECSTaskDefinition_arrays
=== PAUSE TestAccECSTaskDefinition_arrays
=== RUN   TestAccECSTaskDefinition_Fargate_basic
=== PAUSE TestAccECSTaskDefinition_Fargate_basic
=== RUN   TestAccECSTaskDefinition_Fargate_ephemeralStorage
=== PAUSE TestAccECSTaskDefinition_Fargate_ephemeralStorage
=== RUN   TestAccECSTaskDefinition_executionRole
=== PAUSE TestAccECSTaskDefinition_executionRole
=== RUN   TestAccECSTaskDefinition_disappears
=== PAUSE TestAccECSTaskDefinition_disappears
=== RUN   TestAccECSTaskDefinition_tags
=== PAUSE TestAccECSTaskDefinition_tags
=== RUN   TestAccECSTaskDefinition_proxy
=== PAUSE TestAccECSTaskDefinition_proxy
=== RUN   TestAccECSTaskDefinition_inferenceAccelerator
=== PAUSE TestAccECSTaskDefinition_inferenceAccelerator
=== RUN   TestAccECSTaskDefinition_invalidContainerDefinition
=== PAUSE TestAccECSTaskDefinition_invalidContainerDefinition
=== RUN   TestAccECSTaskDefinition_trackLatest
=== PAUSE TestAccECSTaskDefinition_trackLatest
=== RUN   TestAccECSTaskDefinition_unknownContainerDefinitions
=== PAUSE TestAccECSTaskDefinition_unknownContainerDefinitions
=== RUN   TestAccECSTaskDefinition_v5590ContainerDefinitionsRegression
=== PAUSE TestAccECSTaskDefinition_v5590ContainerDefinitionsRegression
=== RUN   TestAccECSTaskDefinition_containerDefinitionEmptyPortMappings
=== PAUSE TestAccECSTaskDefinition_containerDefinitionEmptyPortMappings
=== RUN   TestAccECSTaskDefinition_containerDefinitionDockerLabels
=== PAUSE TestAccECSTaskDefinition_containerDefinitionDockerLabels
=== CONT  TestAccECSTaskDefinition_basic
=== CONT  TestAccECSTaskDefinition_ipcMode
=== CONT  TestAccECSTaskDefinition_tags
--- PASS: TestAccECSTaskDefinition_ipcMode (12.32s)
=== CONT  TestAccECSTaskDefinition_containerDefinitionDockerLabels
--- PASS: TestAccECSTaskDefinition_basic (18.20s)
=== CONT  TestAccECSTaskDefinition_containerDefinitionEmptyPortMappings
--- PASS: TestAccECSTaskDefinition_containerDefinitionDockerLabels (8.66s)
=== CONT  TestAccECSTaskDefinition_v5590ContainerDefinitionsRegression
--- PASS: TestAccECSTaskDefinition_tags (38.44s)
=== CONT  TestAccECSTaskDefinition_unknownContainerDefinitions
--- PASS: TestAccECSTaskDefinition_unknownContainerDefinitions (10.85s)
=== CONT  TestAccECSTaskDefinition_trackLatest
--- PASS: TestAccECSTaskDefinition_trackLatest (11.74s)
=== CONT  TestAccECSTaskDefinition_invalidContainerDefinition
--- PASS: TestAccECSTaskDefinition_invalidContainerDefinition (0.67s)
=== CONT  TestAccECSTaskDefinition_inferenceAccelerator
--- PASS: TestAccECSTaskDefinition_inferenceAccelerator (13.73s)
=== CONT  TestAccECSTaskDefinition_proxy
--- PASS: TestAccECSTaskDefinition_proxy (21.72s)
=== CONT  TestAccECSTaskDefinition_Fargate_basic
--- PASS: TestAccECSTaskDefinition_v5590ContainerDefinitionsRegression (87.74s)
=== CONT  TestAccECSTaskDefinition_disappears
--- PASS: TestAccECSTaskDefinition_Fargate_basic (14.51s)
=== CONT  TestAccECSTaskDefinition_executionRole
--- PASS: TestAccECSTaskDefinition_executionRole (11.87s)
=== CONT  TestAccECSTaskDefinition_Fargate_ephemeralStorage
--- PASS: TestAccECSTaskDefinition_disappears (16.03s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal
--- PASS: TestAccECSTaskDefinition_containerDefinitionEmptyPortMappings (114.09s)
=== CONT  TestAccECSTaskDefinition_networkMode
--- PASS: TestAccECSTaskDefinition_Fargate_ephemeralStorage (10.73s)
=== CONT  TestAccECSTaskDefinition_taskRoleARN
--- PASS: TestAccECSTaskDefinition_networkMode (11.37s)
=== CONT  TestAccECSTaskDefinition_service
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryptionMinimal (19.72s)
=== CONT  TestAccECSTaskDefinition_DockerVolume_taskScoped
--- PASS: TestAccECSTaskDefinition_taskRoleARN (11.35s)
=== CONT  TestAccECSTaskDefinition_fsxWinFileSystem
--- PASS: TestAccECSTaskDefinition_DockerVolume_taskScoped (8.56s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_accessPoint
--- PASS: TestAccECSTaskDefinition_EFSVolume_accessPoint (25.18s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryptionDisabled (20.68s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_transitEncryption
--- PASS: TestAccECSTaskDefinition_EFSVolume_transitEncryption (20.27s)
=== CONT  TestAccECSTaskDefinition_changeVolumesForcesNewResource
--- PASS: TestAccECSTaskDefinition_changeVolumesForcesNewResource (17.58s)
=== CONT  TestAccECSTaskDefinition_arrays
--- PASS: TestAccECSTaskDefinition_arrays (11.23s)
=== CONT  TestAccECSTaskDefinition_constraint
--- PASS: TestAccECSTaskDefinition_service (110.80s)
=== CONT  TestAccECSTaskDefinition_runtimePlatform
=== CONT  TestAccECSTaskDefinition_EFSVolume_basic
--- PASS: TestAccECSTaskDefinition_constraint (12.25s)
--- PASS: TestAccECSTaskDefinition_runtimePlatform (10.75s)
=== CONT  TestAccECSTaskDefinition_EFSVolume_minimal
--- PASS: TestAccECSTaskDefinition_EFSVolume_basic (19.66s)
=== CONT  TestAccECSTaskDefinition_Fargate_runtimePlatformWithoutArch
--- PASS: TestAccECSTaskDefinition_EFSVolume_minimal (19.64s)
=== CONT  TestAccECSTaskDefinition_Fargate_runtimePlatform
--- PASS: TestAccECSTaskDefinition_Fargate_runtimePlatformWithoutArch (10.42s)
=== CONT  TestAccECSTaskDefinition_pidMode
--- PASS: TestAccECSTaskDefinition_Fargate_runtimePlatform (10.54s)
=== CONT  TestAccECSTaskDefinition_DockerVolume_basic
--- PASS: TestAccECSTaskDefinition_pidMode (11.72s)
=== CONT  TestAccECSTaskDefinition_DockerVolume_minimal
--- PASS: TestAccECSTaskDefinition_DockerVolume_basic (10.42s)
=== CONT  TestAccECSTaskDefinition_configuredAtLaunch
--- PASS: TestAccECSTaskDefinition_DockerVolume_minimal (10.49s)
=== CONT  TestAccECSTaskDefinition_scratchVolume
--- PASS: TestAccECSTaskDefinition_configuredAtLaunch (10.38s)
--- PASS: TestAccECSTaskDefinition_scratchVolume (11.01s)
--- PASS: TestAccECSTaskDefinition_fsxWinFileSystem (2952.86s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ecs	3103.293s

@ewbankkit ewbankkit requested a review from a team as a code owner August 9, 2024 18:54
Copy link

github-actions bot commented Aug 9, 2024

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ecs Issues and PRs that pertain to the ecs service. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Aug 9, 2024
Copy link

github-actions bot commented Aug 9, 2024

Thank you for your contribution! 🚀

A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored.

For additional information refer to the AWS SDK for Go Versions page in the contributor guide.

@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Aug 9, 2024
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ewbankkit ewbankkit merged commit 02c06ae into main Aug 9, 2024
35 checks passed
@ewbankkit ewbankkit deleted the b-aws_ecs_task_definition-container_definitions-first-char branch August 9, 2024 21:09
@github-actions github-actions bot added this to the v5.63.0 milestone Aug 9, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Aug 9, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 15, 2024
Copy link

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ecs Issues and PRs that pertain to the ecs service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
2 participants