Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resource/aws_batch_job_definition: Prevent extraneous differences wit…
…h container properties missing environment, mount point, ulimits, and volumes configuration Reference: #11998 Reference: #11488 Now that this resource is properly refreshing the `container_properties` attribute into the Terraform state, additional cases have been reported where the API canonicalizes the response with empty arrays. Here we account for `environment`, `mountPoints`, `ulimits`, and `volumes`. Previous output from unit testing (before code update): ``` 2020/02/11 12:37:58 [DEBUG] Canonical Batch Container Properties JSON are not equal. First: {"command":["start.py","Ref::S3bucket","Ref::S3key"],"image":"example:image","jobRoleArn":"arn:aws:iam::123456789012:role/example","memory":2048,"vcpus":8} Second: {"command":["start.py","Ref::S3bucket","Ref::S3key"],"environment":[],"image":"example:image","jobRoleArn":"arn:aws:iam::123456789012:role/example","memory":2048,"mountPoints":[],"ulimits":[],"vcpus":8,"volumes":[]} --- FAIL: TestEquivalentBatchContainerPropertiesJSON (0.00s) --- FAIL: TestEquivalentBatchContainerPropertiesJSON/empty_environment,_mountPoints,_ulimits,_and_volumes (0.00s) container_properties_test.go:226: got false, expected true ``` Previous output from acceptance testing (before code update): ``` --- FAIL: TestAccAWSBatchJobDefinition_basic (13.16s) testing.go:640: Step 0 error: After applying this step, the plan was not empty: DIFF: DESTROY/CREATE: aws_batch_job_definition.test arn: "arn:aws:batch:us-west-2:--OMITTED--:job-definition/tf-acc-test-118932874341187373:1" => "<computed>" container_properties: "{\"command\":[\"echo\",\"test\"],\"environment\":[],\"image\":\"busybox\",\"memory\":128,\"mountPoints\":[],\"resourceRequirements\":[],\"ulimits\":[],\"vcpus\":1,\"volumes\":[]}" => "{\"command\":[\"echo\",\"test\"],\"image\":\"busybox\",\"memory\":128,\"vcpus\":1}" (forces new resource) id: "arn:aws:batch:us-west-2:--OMITTED--:job-definition/tf-acc-test-118932874341187373:1" => "<computed>" name: "tf-acc-test-118932874341187373" => "tf-acc-test-118932874341187373" retry_strategy.#: "0" => "0" revision: "1" => "<computed>" timeout.#: "0" => "0" type: "container" => "container" ``` Output from acceptance testing: ``` --- PASS: TestAccAWSBatchJobDefinition_basic (16.80s) --- PASS: TestAccAWSBatchJobDefinition_ContainerProperties_Advanced (16.84s) --- PASS: TestAccAWSBatchJobDefinition_updateForcesNewResource (27.13s) ```
- Loading branch information