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

resource/aws_launch_template: Prevent encrypted flag cannot be specified error with block_device_mappings ebs argument #5632

Merged
merged 2 commits into from
Aug 30, 2018

Commits on Aug 30, 2018

  1. resource/aws_launch_template: Prevent encrypted flag cannot be specif…

    …ied error with block_device_mappings ebs argument
    
    * Convert `block_device_mappings` > `ebs` > `delete_on_termination` and `encrypted` to `schema.TypeString`. This to allow an "unspecified" value for the attributes since `schema.TypeBool` only has true/false with false default. The conversion from bare true/false values in configurations to `schema.TypeString` value is currently safe.
    
    Previously:
    
    ```
    --- FAIL: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (11.23s)
    	testing.go:527: Step 0 error: Error applying: 1 error occurred:
    			* aws_autoscaling_group.test: 1 error occurred:
    			* aws_autoscaling_group.test: Error creating AutoScaling Group: ValidationError: You must use a valid fully-formed launch template. the encrypted flag cannot be specified since device /dev/sda1 has a snapshot specified.
    ```
    
    After code adjustments:
    
    ```
    make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchTemplate_'
    ==> Checking that code complies with gofmt requirements...
    TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchTemplate_ -timeout 120m
    === RUN   TestAccAWSLaunchTemplate_importBasic
    --- PASS: TestAccAWSLaunchTemplate_importBasic (13.63s)
    === RUN   TestAccAWSLaunchTemplate_importData
    --- PASS: TestAccAWSLaunchTemplate_importData (12.00s)
    === RUN   TestAccAWSLaunchTemplate_basic
    --- PASS: TestAccAWSLaunchTemplate_basic (12.71s)
    === RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
    --- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (48.73s)
    === RUN   TestAccAWSLaunchTemplate_data
    --- PASS: TestAccAWSLaunchTemplate_data (13.59s)
    === RUN   TestAccAWSLaunchTemplate_update
    --- PASS: TestAccAWSLaunchTemplate_update (46.88s)
    === RUN   TestAccAWSLaunchTemplate_tags
    --- PASS: TestAccAWSLaunchTemplate_tags (21.37s)
    === RUN   TestAccAWSLaunchTemplate_nonBurstable
    --- PASS: TestAccAWSLaunchTemplate_nonBurstable (11.47s)
    === RUN   TestAccAWSLaunchTemplate_networkInterface
    --- PASS: TestAccAWSLaunchTemplate_networkInterface (30.44s)
    PASS
    ok  	github.com/terraform-providers/terraform-provider-aws/aws	211.533s
    ```
    bflad committed Aug 30, 2018
    Configuration menu
    Copy the full SHA
    5b7fbaa View commit details
    Browse the repository at this point in the history
  2. resource/aws_launch_template: Handle bare true/false values correctly…

    … with TypeString boolean attributes
    
    Previously:
    
    ```
    --- FAIL: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (1.27s)
        testing.go:527: Step 0 error: config is invalid: aws_launch_template.test: expected block_device_mappings.0.ebs.0.delete_on_termination to be one of [ false true], got 1
    ```
    
    Now:
    
    ```
    make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchTemplate_'
    ==> Checking that code complies with gofmt requirements...
    TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchTemplate_ -timeout 120m
    === RUN   TestAccAWSLaunchTemplate_importBasic
    --- PASS: TestAccAWSLaunchTemplate_importBasic (13.71s)
    === RUN   TestAccAWSLaunchTemplate_importData
    --- PASS: TestAccAWSLaunchTemplate_importData (11.56s)
    === RUN   TestAccAWSLaunchTemplate_basic
    --- PASS: TestAccAWSLaunchTemplate_basic (12.18s)
    === RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
    --- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (48.61s)
    === RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination
    --- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (48.98s)
    === RUN   TestAccAWSLaunchTemplate_data
    --- PASS: TestAccAWSLaunchTemplate_data (11.61s)
    === RUN   TestAccAWSLaunchTemplate_update
    --- PASS: TestAccAWSLaunchTemplate_update (54.26s)
    === RUN   TestAccAWSLaunchTemplate_tags
    --- PASS: TestAccAWSLaunchTemplate_tags (20.58s)
    === RUN   TestAccAWSLaunchTemplate_nonBurstable
    --- PASS: TestAccAWSLaunchTemplate_nonBurstable (11.58s)
    === RUN   TestAccAWSLaunchTemplate_networkInterface
    --- PASS: TestAccAWSLaunchTemplate_networkInterface (30.64s)
    PASS
    ok  	github.com/terraform-providers/terraform-provider-aws/aws	264.442s
    ```
    bflad committed Aug 30, 2018
    Configuration menu
    Copy the full SHA
    2e8a2b3 View commit details
    Browse the repository at this point in the history