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

Add import support for aws_batch_job_queue #11406

Merged
merged 3 commits into from
Jan 6, 2020

Conversation

prabusah
Copy link
Contributor

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

Relates #11207

Release note for CHANGELOG:

resource/aws_batch_job_queue: support resource import 

Output from acceptance testing:

Did not run acceptance test

...

@prabusah prabusah requested a review from a team December 22, 2019 05:23
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/batch Issues and PRs that pertain to the batch service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Dec 22, 2019
@prabusah prabusah changed the title Add import support for aws_batch_job_queue #11207 Add import support for aws_batch_job_queue Dec 22, 2019
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 2, 2020
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Hi @prabusah 👋 Thanks for submitting this, it is almost complete. Please see the testing failures below and the Contributing Guide section on running acceptance testing if necessary. 👍

testAccCheckBatchJobQueueAttributes(&jq),
),
},
{
ResourceName: resourceName,
ImportState: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This new acceptance testing is currently failing for this test and the others:

--- FAIL: TestAccAWSBatchJobQueue_basic (71.48s)
    testing.go:640: Step 1 error: : Provided name  is not supported pattern[a-zA-Z_0-9-]{1,128}
        	status code: 400, request id: fb70a8c2-e8e2-4417-a94e-7f357fda0ebe

This is happening because the resource Read function is dependent on the name attribute being set:

https://github.com/terraform-providers/terraform-provider-aws/blob/b4a971dfc9db81c20df443b0274f2893a976a30c/aws/resource_aws_batch_job_queue.go#L89

The easiest fix here should be to use the resource ID instead of trying to read the name attribute, since the Batch DescribeJobQueues API notes support for full ARN in addition to just the name, e.g.

jq, err := getJobQueue(conn, d.Id())

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Jan 2, 2020
@prabusah prabusah requested a review from bflad January 4, 2020 22:41
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM, minus the extraneous import testing in the "disappears" testing, which I will fix on merge. Thanks, @prabusah! 🚀

Output from acceptance testing (after disappears test fix):

--- PASS: TestAccAWSBatchJobQueue_disappears (80.44s)
--- PASS: TestAccAWSBatchJobQueue_basic (81.18s)
--- PASS: TestAccAWSBatchJobQueue_update (94.82s)

Comment on lines +103 to +107
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Since _disappears tests are removing the resource in question to verify Terraform triggers recreation of the resource instead of an error, these tests will generate the below error when trying to do ImportState testing:

--- FAIL: TestAccAWSBatchJobQueue_disappears (80.44s)
    testing.go:640: Step 1 error: Resource specified by ResourceName couldn't be found: aws_batch_job_queue.test_queue

The solution here is just to not include the import testing in "disappears" tests like these. 👍

@bflad bflad added this to the v2.44.0 milestone Jan 6, 2020
@bflad bflad merged commit c26deb2 into hashicorp:master Jan 6, 2020
bflad added a commit that referenced this pull request Jan 6, 2020
@ghost
Copy link

ghost commented Jan 10, 2020

This has been released in version 2.44.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!

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Jan 10, 2020
@ghost
Copy link

ghost commented Mar 27, 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 Mar 27, 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/batch Issues and PRs that pertain to the batch service. size/S 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.

2 participants