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

AWS Batch Compute Environment add update_policy parameter #34353

Merged

Conversation

drewmullen
Copy link
Collaborator

@drewmullen drewmullen commented Nov 10, 2023

Closes: #32927, #34145

Resource

$ make testacc TESTS=TestAccBatchComputeEnvironment_ PKG=batch
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/batch/... -v -count 1 -parallel 20 -run='TestAccBatchComputeEnvironment_'  -timeout 360m
=== RUN   TestAccBatchComputeEnvironment_basic
=== PAUSE TestAccBatchComputeEnvironment_basic
=== RUN   TestAccBatchComputeEnvironment_disappears
=== PAUSE TestAccBatchComputeEnvironment_disappears
=== RUN   TestAccBatchComputeEnvironment_nameGenerated
=== PAUSE TestAccBatchComputeEnvironment_nameGenerated
=== RUN   TestAccBatchComputeEnvironment_namePrefix
=== PAUSE TestAccBatchComputeEnvironment_namePrefix
=== RUN   TestAccBatchComputeEnvironment_eksConfiguration
=== PAUSE TestAccBatchComputeEnvironment_eksConfiguration
=== RUN   TestAccBatchComputeEnvironment_createEC2
=== PAUSE TestAccBatchComputeEnvironment_createEC2
=== RUN   TestAccBatchComputeEnvironment_updatePolicyCreate
=== PAUSE TestAccBatchComputeEnvironment_updatePolicyCreate
=== RUN   TestAccBatchComputeEnvironment_updatePolicyUpdate
=== PAUSE TestAccBatchComputeEnvironment_updatePolicyUpdate
=== RUN   TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
=== PAUSE TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
=== RUN   TestAccBatchComputeEnvironment_createSpot
=== PAUSE TestAccBatchComputeEnvironment_createSpot
=== RUN   TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage
=== PAUSE TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage
=== RUN   TestAccBatchComputeEnvironment_createFargate
=== PAUSE TestAccBatchComputeEnvironment_createFargate
=== RUN   TestAccBatchComputeEnvironment_createFargateSpot
=== PAUSE TestAccBatchComputeEnvironment_createFargateSpot
=== RUN   TestAccBatchComputeEnvironment_updateState
=== PAUSE TestAccBatchComputeEnvironment_updateState
=== RUN   TestAccBatchComputeEnvironment_updateServiceRole
=== PAUSE TestAccBatchComputeEnvironment_updateServiceRole
=== RUN   TestAccBatchComputeEnvironment_defaultServiceRole
=== PAUSE TestAccBatchComputeEnvironment_defaultServiceRole
=== RUN   TestAccBatchComputeEnvironment_ComputeResources_minVCPUs
=== PAUSE TestAccBatchComputeEnvironment_ComputeResources_minVCPUs
=== RUN   TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs
=== PAUSE TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs
=== RUN   TestAccBatchComputeEnvironment_ec2Configuration
=== PAUSE TestAccBatchComputeEnvironment_ec2Configuration
=== RUN   TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup
=== PAUSE TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup
=== RUN   TestAccBatchComputeEnvironment_launchTemplate
=== PAUSE TestAccBatchComputeEnvironment_launchTemplate
=== RUN   TestAccBatchComputeEnvironment_updateLaunchTemplate
=== PAUSE TestAccBatchComputeEnvironment_updateLaunchTemplate
=== RUN   TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate
=== PAUSE TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate
=== RUN   TestAccBatchComputeEnvironment_tags
=== PAUSE TestAccBatchComputeEnvironment_tags
=== RUN   TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources
=== PAUSE TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources
=== RUN   TestAccBatchComputeEnvironment_updateEC2
=== PAUSE TestAccBatchComputeEnvironment_updateEC2
=== RUN   TestAccBatchComputeEnvironment_createEC2WithoutComputeResources
=== PAUSE TestAccBatchComputeEnvironment_createEC2WithoutComputeResources
=== CONT  TestAccBatchComputeEnvironment_basic
=== CONT  TestAccBatchComputeEnvironment_updateServiceRole
=== CONT  TestAccBatchComputeEnvironment_createEC2WithoutComputeResources
=== CONT  TestAccBatchComputeEnvironment_createEC2
=== CONT  TestAccBatchComputeEnvironment_ec2Configuration
=== CONT  TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources
=== CONT  TestAccBatchComputeEnvironment_ComputeResources_minVCPUs
=== CONT  TestAccBatchComputeEnvironment_tags
=== CONT  TestAccBatchComputeEnvironment_eksConfiguration
=== CONT  TestAccBatchComputeEnvironment_updatePolicyUpdate
=== CONT  TestAccBatchComputeEnvironment_updateEC2
=== CONT  TestAccBatchComputeEnvironment_createFargateSpot
=== CONT  TestAccBatchComputeEnvironment_createFargate
=== CONT  TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage
=== CONT  TestAccBatchComputeEnvironment_createSpot
=== CONT  TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
=== CONT  TestAccBatchComputeEnvironment_updateLaunchTemplate
=== CONT  TestAccBatchComputeEnvironment_updatePolicyCreate
=== CONT  TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup
=== CONT  TestAccBatchComputeEnvironment_updateState
--- PASS: TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources (144.33s)
=== CONT  TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate
--- PASS: TestAccBatchComputeEnvironment_createEC2WithoutComputeResources (637.26s)
=== CONT  TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs
--- PASS: TestAccBatchComputeEnvironment_basic (1007.97s)
=== CONT  TestAccBatchComputeEnvironment_defaultServiceRole
--- PASS: TestAccBatchComputeEnvironment_createFargate (1131.06s)
=== CONT  TestAccBatchComputeEnvironment_nameGenerated
--- PASS: TestAccBatchComputeEnvironment_createFargateSpot (1164.89s)
=== CONT  TestAccBatchComputeEnvironment_disappears
--- PASS: TestAccBatchComputeEnvironment_createEC2 (1211.40s)
=== CONT  TestAccBatchComputeEnvironment_namePrefix
--- PASS: TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage (1281.13s)
=== CONT  TestAccBatchComputeEnvironment_launchTemplate
--- PASS: TestAccBatchComputeEnvironment_ec2Configuration (1400.07s)
--- PASS: TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup (1498.77s)
--- PASS: TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags (1517.84s)
--- PASS: TestAccBatchComputeEnvironment_updatePolicyUpdate (1649.08s)
--- PASS: TestAccBatchComputeEnvironment_updateState (1661.37s)
--- PASS: TestAccBatchComputeEnvironment_updatePolicyCreate (1661.56s)
--- PASS: TestAccBatchComputeEnvironment_createSpot (1702.94s)
--- PASS: TestAccBatchComputeEnvironment_defaultServiceRole (843.08s)
--- PASS: TestAccBatchComputeEnvironment_updateServiceRole (1889.38s)
--- PASS: TestAccBatchComputeEnvironment_nameGenerated (787.80s)
--- PASS: TestAccBatchComputeEnvironment_disappears (784.71s)
--- PASS: TestAccBatchComputeEnvironment_namePrefix (744.84s)
--- PASS: TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate (1848.79s)
--- PASS: TestAccBatchComputeEnvironment_updateLaunchTemplate (2014.04s)
--- PASS: TestAccBatchComputeEnvironment_tags (2019.20s)
--- PASS: TestAccBatchComputeEnvironment_launchTemplate (795.59s)
--- PASS: TestAccBatchComputeEnvironment_eksConfiguration (2218.33s)
--- PASS: TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs (1623.90s)
--- PASS: TestAccBatchComputeEnvironment_ComputeResources_minVCPUs (2263.76s)
--- PASS: TestAccBatchComputeEnvironment_updateEC2 (2337.19s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/batch      2339.211s

Data Source

make testacc TESTS=TestAccBatchComputeEnvironmentDataSource_ PKG=batch
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/batch/... -v -count 1 -parallel 20 -run='TestAccBatchComputeEnvironmentDataSource_'  -timeout 360m
=== RUN   TestAccBatchComputeEnvironmentDataSource_basic
=== PAUSE TestAccBatchComputeEnvironmentDataSource_basic
=== RUN   TestAccBatchComputeEnvironmentDataSource_basicUpdatePolicy
=== PAUSE TestAccBatchComputeEnvironmentDataSource_basicUpdatePolicy
=== CONT  TestAccBatchComputeEnvironmentDataSource_basic
=== CONT  TestAccBatchComputeEnvironmentDataSource_basicUpdatePolicy
--- PASS: TestAccBatchComputeEnvironmentDataSource_basic (156.73s)
--- PASS: TestAccBatchComputeEnvironmentDataSource_basicUpdatePolicy (192.10s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/batch      194.059s

Copy link

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 size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/batch Issues and PRs that pertain to the batch service. labels Nov 10, 2023
Copy link

Hey @drewmullen 👋 Thank you very much for your contribution! At times, our maintainers need to make direct edits to pull requests in order to help get it ready to be merged. Your current settings do not allow maintainers to make such edits. To help facilitate this, update your pull request to allow such edits as described in GitHub's Allowing changes to a pull request branch created from a fork documentation. (If you're using a fork owned by an organization, your organization may not allow you to change this setting. If that is the case, let us know.)

@terraform-aws-provider terraform-aws-provider bot added needs-triage Waiting for first response or review from a maintainer. external-maintainer Contribution from a trusted external contributor. labels Nov 10, 2023
@drewmullen drewmullen changed the title AWS Batch Compute Environment add update_policy parameter [WIP] AWS Batch Compute Environment add update_policy parameter Nov 10, 2023
@drewmullen drewmullen force-pushed the f-batch_compute_environment-update-policy branch from 143e24e to d32f491 Compare November 10, 2023 19:14
@drewmullen drewmullen force-pushed the f-batch_compute_environment-update-policy branch from d32f491 to a2fa6bf Compare November 10, 2023 19:16
@drewmullen drewmullen changed the title [WIP] AWS Batch Compute Environment add update_policy parameter AWS Batch Compute Environment add update_policy parameter Nov 10, 2023
Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@AdamTylerLynch AdamTylerLynch removed the needs-triage Waiting for first response or review from a maintainer. label Nov 13, 2023
@jar-b jar-b self-assigned this Dec 19, 2023
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Dec 19, 2023
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.

Looks good! I wasn't able to commit to the downstream branch, so left a couple suggestions with what I'd changed locally. Just one small typo/logging fix and a documentation fix.

Will run the full test suite and merge after the changes go through.

internal/service/batch/compute_environment.go Outdated Show resolved Hide resolved
website/docs/d/batch_compute_environment.html.markdown Outdated Show resolved Hide resolved
@drewmullen
Copy link
Collaborator Author

@jar-b how did you do multi-line `suggestion boxes?

image

@drewmullen
Copy link
Collaborator Author

Also, going foward we wont use orgs for PR sources and instead will use personal repos. That is whats preventing you from committing back upstream - apologies for that

@jar-b
Copy link
Member

jar-b commented Dec 19, 2023

@jar-b how did you do multi-line `suggestion boxes?

Just to the left of the -/+ diff markers there is a blue box you can drag across multiple lines.

image

@jar-b
Copy link
Member

jar-b commented Dec 19, 2023

Also, going foward we wont use orgs for PR sources and instead will use personal repos. That is whats preventing you from committing back upstream - apologies for that

No problem - thanks for getting the changes in. Running tests now.

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 🎉

% make testacc PKG=batch TESTS="TestAccBatchComputeEnvironment_|TestAccBatchComputeEnvironmentDataSource_"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/batch/... -v -count 1 -parallel 20 -run='TestAccBatchComputeEnvironment_|TestAccBatchComputeEnvironmentDataSource_'  -timeout 360m

--- PASS: TestAccBatchComputeEnvironment_createUnmanagedWithComputeResources (4.51s)
=== CONT  TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate
--- PASS: TestAccBatchComputeEnvironment_createEC2WithoutComputeResources (32.74s)
=== CONT  TestAccBatchComputeEnvironment_ec2Configuration
--- PASS: TestAccBatchComputeEnvironment_createFargate (37.77s)
=== CONT  TestAccBatchComputeEnvironment_updateLaunchTemplate
--- PASS: TestAccBatchComputeEnvironmentDataSource_basic (40.38s)
=== CONT  TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs
--- PASS: TestAccBatchComputeEnvironment_CreateSpotAllocationStrategy_bidPercentage (52.92s)
=== CONT  TestAccBatchComputeEnvironment_launchTemplate
=== CONT  TestAccBatchComputeEnvironment_updatePolicyUpdate
--- PASS: TestAccBatchComputeEnvironment_disappears (52.99s)
--- PASS: TestAccBatchComputeEnvironmentDataSource_basicUpdatePolicy (54.44s)
=== CONT  TestAccBatchComputeEnvironment_defaultServiceRole
=== NAME  TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
    compute_environment_test.go:481: Step 1/2 error: After applying this test step and performing a `terraform refresh`, the plan was not empty.
        stdout


        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place

        Terraform will perform the following actions:

          # aws_batch_compute_environment.test will be updated in-place
          ~ resource "aws_batch_compute_environment" "test" {
                id                       = "tf-acc-test-8202777925839378489"
                tags                     = {}
                # (9 unchanged attributes hidden)

              ~ compute_resources {
                  ~ desired_vcpus      = 4 -> 8
                    tags               = {
                        "key1" = "value1"
                    }
                    # (10 unchanged attributes hidden)

                    # (1 unchanged block hidden)
                }
            }

        Plan: 0 to add, 1 to change, 0 to destroy.
--- PASS: TestAccBatchComputeEnvironment_createEC2 (64.28s)
=== CONT  TestAccBatchComputeEnvironment_updateServiceRole
--- PASS: TestAccBatchComputeEnvironment_nameGenerated (65.61s)
=== CONT  TestAccBatchComputeEnvironment_basic
--- PASS: TestAccBatchComputeEnvironment_namePrefix (66.60s)
--- PASS: TestAccBatchComputeEnvironment_createFargateSpot (67.08s)
--- PASS: TestAccBatchComputeEnvironment_ec2ConfigurationPlacementGroup (68.61s)
--- PASS: TestAccBatchComputeEnvironment_updateState (70.35s)
--- PASS: TestAccBatchComputeEnvironment_ec2Configuration (38.36s)
--- PASS: TestAccBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_fargate (73.23s)
--- PASS: TestAccBatchComputeEnvironment_tags (78.15s)
--- PASS: TestAccBatchComputeEnvironment_updatePolicyCreate (85.95s)
--- PASS: TestAccBatchComputeEnvironment_defaultServiceRole (32.77s)
--- PASS: TestAccBatchComputeEnvironment_launchTemplate (35.03s)
--- PASS: TestAccBatchComputeEnvironment_basic (29.76s)
--- PASS: TestAccBatchComputeEnvironment_updateLaunchTemplate (59.30s)
--- PASS: TestAccBatchComputeEnvironment_updatePolicyUpdate (45.57s)
--- PASS: TestAccBatchComputeEnvironment_updateEC2 (107.14s)
--- PASS: TestAccBatchComputeEnvironment_ComputeResources_maxVCPUs (69.31s)
--- PASS: TestAccBatchComputeEnvironment_updateServiceRole (64.83s)
--- PASS: TestAccBatchComputeEnvironment_ComputeResources_minVCPUs (201.94s)
--- FAIL: TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags (284.80s)
--- PASS: TestAccBatchComputeEnvironment_createSpot (472.97s)
--- PASS: TestAccBatchComputeEnvironment_eksConfiguration (713.40s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/batch      716.838s

Failed test is unrelated to these changes and transient, passing after re-running:

% make testacc PKG=batch TESTS=TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/batch/... -v -count 1 -parallel 20 -run='TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags'  -timeout 360m
=== RUN   TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
=== PAUSE TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
=== CONT  TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags
--- PASS: TestAccBatchComputeEnvironment_CreateEC2DesiredVCPUsEC2KeyPairImageID_computeResourcesTags (65.30s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/batch      68.466s

@jar-b jar-b merged commit 0215a25 into hashicorp:main Dec 19, 2023
43 checks passed
@jar-b
Copy link
Member

jar-b commented Dec 19, 2023

Thanks for your contribution, @drewmullen! 👍

@github-actions github-actions bot added this to the v5.32.0 milestone Dec 19, 2023
Copy link

This functionality has been released in v5.32.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 Feb 12, 2024
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. external-maintainer Contribution from a trusted external contributor. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/batch Issues and PRs that pertain to the batch 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.

[Enhancement]: Support UpdatePolicy for aws_batch_compute_environment
3 participants