-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ func TestAccAWSBatchJobQueue_basic(t *testing.T) { | |
var jq batch.JobQueueDetail | ||
ri := acctest.RandInt() | ||
config := fmt.Sprintf(testAccBatchJobQueueBasic, ri) | ||
resourceName := "aws_batch_job_queue.test_queue" | ||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, | ||
Providers: testAccProviders, | ||
|
@@ -68,10 +69,15 @@ func TestAccAWSBatchJobQueue_basic(t *testing.T) { | |
{ | ||
Config: config, | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckBatchJobQueueExists("aws_batch_job_queue.test_queue", &jq), | ||
testAccCheckBatchJobQueueExists(resourceName, &jq), | ||
testAccCheckBatchJobQueueAttributes(&jq), | ||
), | ||
}, | ||
{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
@@ -94,6 +100,11 @@ func TestAccAWSBatchJobQueue_disappears(t *testing.T) { | |
), | ||
ExpectNonEmptyPlan: true, | ||
}, | ||
{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
Comment on lines
+103
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
The solution here is just to not include the import testing in "disappears" tests like these. 👍 |
||
}, | ||
}) | ||
} | ||
|
@@ -103,6 +114,7 @@ func TestAccAWSBatchJobQueue_update(t *testing.T) { | |
ri := acctest.RandInt() | ||
config := fmt.Sprintf(testAccBatchJobQueueBasic, ri) | ||
updateConfig := fmt.Sprintf(testAccBatchJobQueueUpdate, ri) | ||
resourceName := "aws_batch_job_queue.test_queue" | ||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, | ||
Providers: testAccProviders, | ||
|
@@ -111,17 +123,22 @@ func TestAccAWSBatchJobQueue_update(t *testing.T) { | |
{ | ||
Config: config, | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckBatchJobQueueExists("aws_batch_job_queue.test_queue", &jq), | ||
testAccCheckBatchJobQueueExists(resourceName, &jq), | ||
testAccCheckBatchJobQueueAttributes(&jq), | ||
), | ||
}, | ||
{ | ||
Config: updateConfig, | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckBatchJobQueueExists("aws_batch_job_queue.test_queue", &jq), | ||
testAccCheckBatchJobQueueExists(resourceName, &jq), | ||
testAccCheckBatchJobQueueAttributes(&jq), | ||
), | ||
}, | ||
{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
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:
This is happening because the resource
Read
function is dependent on thename
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.