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_batch_compute_environment: service_role is optional, fix "At least one compute-resources attribute must be specified" error. #19205

Merged
merged 2 commits into from
May 6, 2021

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented May 3, 2021

Community Note

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

Closes #19178.
Closes #19177.

Output from acceptance testing:

In account with service-linked role:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBatchComputeEnvironment_defaultServiceRole\|TestAccAWSBatchComputeEnvironment_updateServiceRole'
==> Checking that code complies with gofmt requirements...
 F_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBatchComputeEnvironment_defaultServiceRole\|TestAccAWSBatchComputeEnvironment_updateServiceRole -timeout 180m
=== RUN   TestAccAWSBatchComputeEnvironment_updateServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_updateServiceRole
=== RUN   TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_updateServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_defaultServiceRole
--- PASS: TestAccAWSBatchComputeEnvironment_defaultServiceRole (36.49s)
--- PASS: TestAccAWSBatchComputeEnvironment_updateServiceRole (76.64s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       79.455s
Commercial
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBatchComputeEnvironment_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBatchComputeEnvironment_ -timeout 180m
=== RUN   TestAccAWSBatchComputeEnvironment_basic
=== PAUSE TestAccAWSBatchComputeEnvironment_basic
=== RUN   TestAccAWSBatchComputeEnvironment_disappears
=== PAUSE TestAccAWSBatchComputeEnvironment_disappears
=== RUN   TestAccAWSBatchComputeEnvironment_NameGenerated
=== PAUSE TestAccAWSBatchComputeEnvironment_NameGenerated
=== RUN   TestAccAWSBatchComputeEnvironment_NamePrefix
=== PAUSE TestAccAWSBatchComputeEnvironment_NamePrefix
=== RUN   TestAccAWSBatchComputeEnvironment_createEc2
=== PAUSE TestAccAWSBatchComputeEnvironment_createEc2
=== RUN   TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags
=== PAUSE TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags
=== RUN   TestAccAWSBatchComputeEnvironment_createSpot
=== PAUSE TestAccAWSBatchComputeEnvironment_createSpot
=== RUN   TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage
=== PAUSE TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage
=== RUN   TestAccAWSBatchComputeEnvironment_createFargate
=== PAUSE TestAccAWSBatchComputeEnvironment_createFargate
=== RUN   TestAccAWSBatchComputeEnvironment_createFargateSpot
=== PAUSE TestAccAWSBatchComputeEnvironment_createFargateSpot
=== RUN   TestAccAWSBatchComputeEnvironment_updateState
=== PAUSE TestAccAWSBatchComputeEnvironment_updateState
=== RUN   TestAccAWSBatchComputeEnvironment_updateServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_updateServiceRole
=== RUN   TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== RUN   TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus
=== PAUSE TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus
=== RUN   TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus
=== PAUSE TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus
=== RUN   TestAccAWSBatchComputeEnvironment_launchTemplate
=== PAUSE TestAccAWSBatchComputeEnvironment_launchTemplate
=== RUN   TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate
=== PAUSE TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate
=== RUN   TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate
=== PAUSE TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate
=== RUN   TestAccAWSBatchComputeEnvironment_Tags
=== PAUSE TestAccAWSBatchComputeEnvironment_Tags
=== RUN   TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources
=== PAUSE TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources
=== RUN   TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources
=== PAUSE TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources
=== RUN   TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole
=== PAUSE TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole
=== CONT  TestAccAWSBatchComputeEnvironment_basic
=== CONT  TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_createSpot
=== CONT  TestAccAWSBatchComputeEnvironment_NamePrefix
=== CONT  TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags
=== CONT  TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage
=== CONT  TestAccAWSBatchComputeEnvironment_createEc2
=== CONT  TestAccAWSBatchComputeEnvironment_Tags
=== CONT  TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole
=== CONT  TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources
=== CONT  TestAccAWSBatchComputeEnvironment_launchTemplate
=== CONT  TestAccAWSBatchComputeEnvironment_updateServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate
=== CONT  TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate
=== CONT  TestAccAWSBatchComputeEnvironment_NameGenerated
=== CONT  TestAccAWSBatchComputeEnvironment_disappears
=== CONT  TestAccAWSBatchComputeEnvironment_updateState
=== CONT  TestAccAWSBatchComputeEnvironment_createFargateSpot
=== CONT  TestAccAWSBatchComputeEnvironment_createFargate
=== CONT  TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources
=== CONT  TestAccAWSBatchComputeEnvironment_defaultServiceRole
    provider_test.go:821: skipping tests; missing IAM service-linked role /aws-service-role/batch. Please create the role and retry
--- SKIP: TestAccAWSBatchComputeEnvironment_defaultServiceRole (1.62s)
=== CONT  TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus
--- PASS: TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole (31.65s)
=== CONT  TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus
--- PASS: TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources (34.04s)
--- PASS: TestAccAWSBatchComputeEnvironment_createFargateSpot (52.71s)
--- PASS: TestAccAWSBatchComputeEnvironment_NamePrefix (53.88s)
--- PASS: TestAccAWSBatchComputeEnvironment_launchTemplate (54.27s)
--- PASS: TestAccAWSBatchComputeEnvironment_NameGenerated (55.52s)
--- PASS: TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage (66.50s)
--- PASS: TestAccAWSBatchComputeEnvironment_disappears (67.25s)
--- PASS: TestAccAWSBatchComputeEnvironment_createEc2 (70.52s)
--- PASS: TestAccAWSBatchComputeEnvironment_basic (71.05s)
--- PASS: TestAccAWSBatchComputeEnvironment_createFargate (74.05s)
--- PASS: TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources (81.18s)
--- PASS: TestAccAWSBatchComputeEnvironment_updateState (94.07s)
--- PASS: TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate (103.72s)
--- PASS: TestAccAWSBatchComputeEnvironment_updateServiceRole (104.97s)
--- PASS: TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate (105.38s)
--- PASS: TestAccAWSBatchComputeEnvironment_Tags (114.62s)
--- PASS: TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus (119.19s)
--- PASS: TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags (198.31s)
--- PASS: TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus (226.88s)
--- PASS: TestAccAWSBatchComputeEnvironment_createSpot (498.44s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	504.096s
GovCloud
% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBatchComputeEnvironment_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBatchComputeEnvironment_ -timeout 180m
=== RUN   TestAccAWSBatchComputeEnvironment_basic
=== PAUSE TestAccAWSBatchComputeEnvironment_basic
=== RUN   TestAccAWSBatchComputeEnvironment_disappears
=== PAUSE TestAccAWSBatchComputeEnvironment_disappears
=== RUN   TestAccAWSBatchComputeEnvironment_NameGenerated
=== PAUSE TestAccAWSBatchComputeEnvironment_NameGenerated
=== RUN   TestAccAWSBatchComputeEnvironment_NamePrefix
=== PAUSE TestAccAWSBatchComputeEnvironment_NamePrefix
=== RUN   TestAccAWSBatchComputeEnvironment_createEc2
=== PAUSE TestAccAWSBatchComputeEnvironment_createEc2
=== RUN   TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags
=== PAUSE TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags
=== RUN   TestAccAWSBatchComputeEnvironment_createSpot
=== PAUSE TestAccAWSBatchComputeEnvironment_createSpot
=== RUN   TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage
=== PAUSE TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage
=== RUN   TestAccAWSBatchComputeEnvironment_createFargate
=== PAUSE TestAccAWSBatchComputeEnvironment_createFargate
=== RUN   TestAccAWSBatchComputeEnvironment_createFargateSpot
=== PAUSE TestAccAWSBatchComputeEnvironment_createFargateSpot
=== RUN   TestAccAWSBatchComputeEnvironment_updateState
=== PAUSE TestAccAWSBatchComputeEnvironment_updateState
=== RUN   TestAccAWSBatchComputeEnvironment_updateServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_updateServiceRole
=== RUN   TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== RUN   TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus
=== PAUSE TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus
=== RUN   TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus
=== PAUSE TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus
=== RUN   TestAccAWSBatchComputeEnvironment_launchTemplate
=== PAUSE TestAccAWSBatchComputeEnvironment_launchTemplate
=== RUN   TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate
=== PAUSE TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate
=== RUN   TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate
=== PAUSE TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate
=== RUN   TestAccAWSBatchComputeEnvironment_Tags
=== PAUSE TestAccAWSBatchComputeEnvironment_Tags
=== RUN   TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources
=== PAUSE TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources
=== RUN   TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources
=== PAUSE TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources
=== RUN   TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole
=== PAUSE TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole
=== CONT  TestAccAWSBatchComputeEnvironment_basic
=== CONT  TestAccAWSBatchComputeEnvironment_launchTemplate
=== CONT  TestAccAWSBatchComputeEnvironment_Tags
=== CONT  TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate
=== CONT  TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate
=== CONT  TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole
=== CONT  TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources
=== CONT  TestAccAWSBatchComputeEnvironment_createEc2
=== CONT  TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources
=== CONT  TestAccAWSBatchComputeEnvironment_updateServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_createFargate
=== CONT  TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage
=== CONT  TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus
=== CONT  TestAccAWSBatchComputeEnvironment_createSpot
=== CONT  TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags
=== CONT  TestAccAWSBatchComputeEnvironment_updateState
=== CONT  TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus
=== CONT  TestAccAWSBatchComputeEnvironment_createFargateSpot
=== CONT  TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_NameGenerated
=== CONT  TestAccAWSBatchComputeEnvironment_defaultServiceRole
    provider_test.go:821: skipping tests; missing IAM service-linked role /aws-service-role/batch. Please create the role and retry
--- SKIP: TestAccAWSBatchComputeEnvironment_defaultServiceRole (2.65s)
=== CONT  TestAccAWSBatchComputeEnvironment_NamePrefix
--- PASS: TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources (34.24s)
=== CONT  TestAccAWSBatchComputeEnvironment_disappears
--- PASS: TestAccAWSBatchComputeEnvironment_createSpotWithoutIamFleetRole (35.42s)
--- PASS: TestAccAWSBatchComputeEnvironment_basic (61.14s)
--- PASS: TestAccAWSBatchComputeEnvironment_launchTemplate (67.69s)
--- PASS: TestAccAWSBatchComputeEnvironment_createFargateSpot (71.51s)
--- PASS: TestAccAWSBatchComputeEnvironment_createSpot_AllocationStrategy_BidPercentage (73.49s)
--- PASS: TestAccAWSBatchComputeEnvironment_createFargate (73.71s)
--- PASS: TestAccAWSBatchComputeEnvironment_NameGenerated (75.96s)
--- PASS: TestAccAWSBatchComputeEnvironment_createEc2 (78.08s)
--- PASS: TestAccAWSBatchComputeEnvironment_NamePrefix (76.09s)
--- PASS: TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources (79.94s)
--- PASS: TestAccAWSBatchComputeEnvironment_disappears (50.94s)
--- PASS: TestAccAWSBatchComputeEnvironment_UpdateSecurityGroupsAndSubnets_Fargate (96.76s)
--- PASS: TestAccAWSBatchComputeEnvironment_updateState (103.02s)
--- PASS: TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate (109.39s)
--- PASS: TestAccAWSBatchComputeEnvironment_updateServiceRole (109.65s)
--- PASS: TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus (118.94s)
--- PASS: TestAccAWSBatchComputeEnvironment_Tags (120.09s)
--- PASS: TestAccAWSBatchComputeEnvironment_createEc2_DesiredVcpus_Ec2KeyPair_ImageId_ComputeResourcesTags (176.01s)
--- PASS: TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus (236.55s)
--- PASS: TestAccAWSBatchComputeEnvironment_createSpot (499.38s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	502.314s

r/aws_batch_compute_environment: Fix "At least one compute-resources attribute must be specified" error.

Acceptance test output:

% make testacc TEST=./aws TESTARGS='-run=TestAccAWSBatchComputeEnvironment_defaultServiceRole\|TestAccAWSBatchComputeEnvironment_updateServiceRole'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSBatchComputeEnvironment_defaultServiceRole\|TestAccAWSBatchComputeEnvironment_updateServiceRole -timeout 180m
=== RUN   TestAccAWSBatchComputeEnvironment_updateServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_updateServiceRole
=== RUN   TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== PAUSE TestAccAWSBatchComputeEnvironment_defaultServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_updateServiceRole
=== CONT  TestAccAWSBatchComputeEnvironment_defaultServiceRole
--- PASS: TestAccAWSBatchComputeEnvironment_defaultServiceRole (36.49s)
--- PASS: TestAccAWSBatchComputeEnvironment_updateServiceRole (76.64s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	79.455s
@ewbankkit ewbankkit requested a review from a team as a code owner May 3, 2021 13:12
@ghost ghost added size/L Managed by automation to categorize the size of a PR. service/batch Issues and PRs that pertain to the batch service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels May 3, 2021
@anGie44 anGie44 self-assigned this May 6, 2021
@anGie44 anGie44 added the bug Addresses a defect in current functionality. label May 6, 2021
Copy link
Contributor

@anGie44 anGie44 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 b864a98 into main May 6, 2021
@ewbankkit ewbankkit deleted the b-aws_batch_compute_environment-regressions branch May 6, 2021 17:12
@github-actions github-actions bot added this to the v3.39.0 milestone May 6, 2021
github-actions bot pushed a commit that referenced this pull request May 6, 2021
@ghost
Copy link

ghost commented May 7, 2021

This has been released in version 3.39.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 for triage. Thanks!

@github-actions
Copy link

github-actions bot commented Jun 6, 2021

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 Jun 6, 2021
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/batch Issues and PRs that pertain to the batch service. size/L 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
2 participants