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/launch_configuration: introduce user_data_base64 #4257

Merged
merged 3 commits into from
Apr 20, 2018

Conversation

loivis
Copy link
Contributor

@loivis loivis commented Apr 18, 2018

fix #4197, an issue caused by #2800

As spotted with #4197 (comment), try to borrow logic from aws_instance and introduce user_data_base64 as fix.

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 18, 2018
@loivis
Copy link
Contributor Author

loivis commented Apr 18, 2018

⎇  make fmt; and echo > aws/debug.log ; and make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchConfiguration_'
gofmt -w $(find . -name '*.go' |grep -v vendor)
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchConfiguration_ -timeout 120m
=== RUN   TestAccAWSLaunchConfiguration_importBasic
--- PASS: TestAccAWSLaunchConfiguration_importBasic (44.71s)
=== RUN   TestAccAWSLaunchConfiguration_basic
--- PASS: TestAccAWSLaunchConfiguration_basic (105.32s)
=== RUN   TestAccAWSLaunchConfiguration_withBlockDevices
--- PASS: TestAccAWSLaunchConfiguration_withBlockDevices (75.61s)
=== RUN   TestAccAWSLaunchConfiguration_updateRootBlockDevice
--- PASS: TestAccAWSLaunchConfiguration_updateRootBlockDevice (120.58s)
=== RUN   TestAccAWSLaunchConfiguration_withSpotPrice
--- PASS: TestAccAWSLaunchConfiguration_withSpotPrice (75.36s)
=== RUN   TestAccAWSLaunchConfiguration_withVpcClassicLink
--- PASS: TestAccAWSLaunchConfiguration_withVpcClassicLink (63.80s)
=== RUN   TestAccAWSLaunchConfiguration_withIAMProfile
--- PASS: TestAccAWSLaunchConfiguration_withIAMProfile (110.68s)
=== RUN   TestAccAWSLaunchConfiguration_withEncryption
--- PASS: TestAccAWSLaunchConfiguration_withEncryption (74.11s)
=== RUN   TestAccAWSLaunchConfiguration_updateEbsBlockDevices
--- PASS: TestAccAWSLaunchConfiguration_updateEbsBlockDevices (122.56s)
=== RUN   TestAccAWSLaunchConfiguration_ebs_noDevice
--- PASS: TestAccAWSLaunchConfiguration_ebs_noDevice (36.32s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	829.154s
⎇  make fmt; and echo > aws/debug.log ; and make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchConfiguration_userData'
gofmt -w $(find . -name '*.go' |grep -v vendor)
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchConfiguration_userData -timeout 120m
=== RUN   TestAccAWSLaunchConfiguration_userData
--- PASS: TestAccAWSLaunchConfiguration_userData (108.36s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	108.439s

@loivis loivis force-pushed the 4197-launch-configuration-user-data branch from 581b930 to 96a366a Compare April 18, 2018 21:30
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 18, 2018
@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. enhancement Requests to existing resources that expand the functionality or scope. and removed bug Addresses a defect in current functionality. labels Apr 20, 2018
@bflad
Copy link
Contributor

bflad commented Apr 20, 2018

Hmm. I'm consistently getting testing failures in us-west-2:

=== RUN   TestAccAWSLaunchConfiguration_updateEbsBlockDevices
--- FAIL: TestAccAWSLaunchConfiguration_updateEbsBlockDevices (80.75s)
    testing.go:518: Step 1 error: After applying this step and refreshing, the plan was not empty:
        
        DIFF:
        
        DESTROY/CREATE: aws_launch_configuration.baz
          associate_public_ip_address:                       "false" => "false"
          ebs_block_device.#:                                "2" => "1"
          ebs_block_device.4131155854.delete_on_termination: "true" => "true"
          ebs_block_device.4131155854.device_name:           "/dev/sdb" => "/dev/sdb"
          ebs_block_device.4131155854.encrypted:             "true" => "true"
          ebs_block_device.4131155854.iops:                  "0" => "<computed>"
          ebs_block_device.4131155854.no_device:             "false" => ""
          ebs_block_device.4131155854.snapshot_id:           "" => "<computed>"
          ebs_block_device.4131155854.volume_size:           "10" => "10"
          ebs_block_device.4131155854.volume_type:           "" => "<computed>"
          ebs_block_device.486837074.delete_on_termination:  "true" => "false" (forces new resource)
          ebs_block_device.486837074.device_name:            "xvdco" => "" (forces new resource)
          ebs_block_device.486837074.no_device:              "false" => "false"
          ebs_optimized:                                     "false" => "<computed>"
          enable_monitoring:                                 "true" => "true"
          image_id:                                          "ami-f83e5180" => "ami-f83e5180"
          instance_type:                                     "t2.micro" => "t2.micro"
          key_name:                                          "" => "<computed>"
          name:                                              "terraform-20180420142505971700000002" => "<computed>"
          root_block_device.#:                               "0" => "1"
          root_block_device.0.delete_on_termination:         "" => "true" (forces new resource)
          root_block_device.0.iops:                          "" => "<computed>"
          root_block_device.0.volume_size:                   "" => "11" (forces new resource)
          root_block_device.0.volume_type:                   "" => "gp2" (forces new resource)

=== RUN   TestAccAWSLaunchConfiguration_updateRootBlockDevice
--- FAIL: TestAccAWSLaunchConfiguration_updateRootBlockDevice (89.24s)
    testing.go:518: Step 1 error: After applying this step and refreshing, the plan was not empty:
        
        DIFF:
        
        DESTROY/CREATE: aws_launch_configuration.bar
          associate_public_ip_address:               "true" => "true"
          ebs_block_device.#:                        "1" => "<computed>"
          ebs_optimized:                             "false" => "<computed>"
          enable_monitoring:                         "true" => "true"
          image_id:                                  "ami-f83e5180" => "ami-f83e5180"
          instance_type:                             "m1.small" => "m1.small"
          key_name:                                  "" => "<computed>"
          name:                                      "tf-acc-test-718685494963449961120180420142512221900000002" => "<computed>"
          name_prefix:                               "tf-acc-test-7186854949634499611" => "tf-acc-test-7186854949634499611"
          root_block_device.#:                       "0" => "1"
          root_block_device.0.delete_on_termination: "" => "true" (forces new resource)
          root_block_device.0.iops:                  "" => "<computed>"
          root_block_device.0.volume_size:           "" => "20" (forces new resource)
          root_block_device.0.volume_type:           "" => "gp2" (forces new resource)
          user_data:                                 "f9b375662f3ccb320a2d59fefdfa0f79ee9be21c" => "f9b375662f3ccb320a2d59fefdfa0f79ee9be21c"

=== RUN   TestAccAWSLaunchConfiguration_withBlockDevices
--- FAIL: TestAccAWSLaunchConfiguration_withBlockDevices (65.95s)
    testing.go:518: Step 0 error: After applying this step and refreshing, the plan was not empty:
        
        DIFF:
        
        DESTROY/CREATE: aws_launch_configuration.bar
          associate_public_ip_address:                      "true" => "true"
          ebs_block_device.#:                               "3" => "2"
          ebs_block_device.415261930.delete_on_termination: "true" => "true"
          ebs_block_device.415261930.device_name:           "/dev/sdc" => "/dev/sdc"
          ebs_block_device.415261930.encrypted:             "false" => "<computed>"
          ebs_block_device.415261930.iops:                  "100" => "100"
          ebs_block_device.415261930.no_device:             "false" => ""
          ebs_block_device.415261930.snapshot_id:           "" => "<computed>"
          ebs_block_device.415261930.volume_size:           "10" => "10"
          ebs_block_device.415261930.volume_type:           "io1" => "io1"
          ebs_block_device.766970953.delete_on_termination: "true" => "false" (forces new resource)
          ebs_block_device.766970953.device_name:           "/dev/sda1" => "" (forces new resource)
          ebs_block_device.766970953.no_device:             "false" => "false"
          ebs_block_device.784505502.delete_on_termination: "true" => "true"
          ebs_block_device.784505502.device_name:           "/dev/sdb" => "/dev/sdb"
          ebs_block_device.784505502.encrypted:             "false" => "<computed>"
          ebs_block_device.784505502.iops:                  "0" => "<computed>"
          ebs_block_device.784505502.no_device:             "false" => ""
          ebs_block_device.784505502.snapshot_id:           "" => "<computed>"
          ebs_block_device.784505502.volume_size:           "9" => "9"
          ebs_block_device.784505502.volume_type:           "" => "<computed>"
          ebs_optimized:                                    "false" => "<computed>"
          enable_monitoring:                                "true" => "true"
          ephemeral_block_device.#:                         "1" => "1"
          ephemeral_block_device.1692014856.device_name:    "/dev/sde" => "/dev/sde"
          ephemeral_block_device.1692014856.virtual_name:   "ephemeral0" => "ephemeral0"
          image_id:                                         "ami-f83e5180" => "ami-f83e5180"
          instance_type:                                    "m1.small" => "m1.small"
          key_name:                                         "" => "<computed>"
          name:                                             "tf-acc-test-3907438456770510797" => "tf-acc-test-3907438456770510797"
          root_block_device.#:                              "0" => "1"
          root_block_device.0.delete_on_termination:        "" => "true" (forces new resource)
          root_block_device.0.iops:                         "" => "<computed>"
          root_block_device.0.volume_size:                  "" => "11" (forces new resource)
          root_block_device.0.volume_type:                  "" => "gp2" (forces new resource)
          user_data:                                        "f9b375662f3ccb320a2d59fefdfa0f79ee9be21c" => "f9b375662f3ccb320a2d59fefdfa0f79ee9be21c"

=== RUN   TestAccAWSLaunchConfiguration_withEncryption
--- FAIL: TestAccAWSLaunchConfiguration_withEncryption (52.16s)
    testing.go:518: Step 0 error: Check failed: Check 2/2 error: block device doesn't exist: /dev/sda1

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 20, 2018
@loivis
Copy link
Contributor Author

loivis commented Apr 20, 2018

That's weird. I just tried with us-west-2 without error. I also checked the image from debug log, which shows image_id = ami-f83e5180. It is an image from that region.

⎇  set -x AWS_REGION us-west-2
⎇  make fmt; and echo > aws/debug.log ; and make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchConfiguration_withBlockDevices'
gofmt -w $(find . -name '*.go' |grep -v vendor)
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchConfiguration_withBlockDevices -timeout 120m
=== RUN   TestAccAWSLaunchConfiguration_withBlockDevices
--- PASS: TestAccAWSLaunchConfiguration_withBlockDevices (101.16s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	101.283s

@loivis
Copy link
Contributor Author

loivis commented Apr 20, 2018

Now I get the same error. Those tests depend on details of ami, specially on blocking devices. I'll fix it soon.

@loivis loivis force-pushed the 4197-launch-configuration-user-data branch from 96a366a to be0f4f3 Compare April 20, 2018 18:16
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 20, 2018
@loivis loivis force-pushed the 4197-launch-configuration-user-data branch from be0f4f3 to bb46210 Compare April 20, 2018 19:20
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 20, 2018
@loivis loivis force-pushed the 4197-launch-configuration-user-data branch from bb46210 to d569210 Compare April 20, 2018 19:30
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Apr 20, 2018
@loivis
Copy link
Contributor Author

loivis commented Apr 20, 2018

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSLaunchConfiguration_ -timeout 120m
=== RUN   TestAccAWSLaunchConfiguration_importBasic
--- PASS: TestAccAWSLaunchConfiguration_importBasic (40.01s)
=== RUN   TestAccAWSLaunchConfiguration_basic
--- PASS: TestAccAWSLaunchConfiguration_basic (78.54s)
=== RUN   TestAccAWSLaunchConfiguration_withBlockDevices
--- PASS: TestAccAWSLaunchConfiguration_withBlockDevices (48.68s)
=== RUN   TestAccAWSLaunchConfiguration_updateRootBlockDevice
--- PASS: TestAccAWSLaunchConfiguration_updateRootBlockDevice (87.64s)
=== RUN   TestAccAWSLaunchConfiguration_withSpotPrice
--- PASS: TestAccAWSLaunchConfiguration_withSpotPrice (50.50s)
=== RUN   TestAccAWSLaunchConfiguration_withVpcClassicLink
--- PASS: TestAccAWSLaunchConfiguration_withVpcClassicLink (80.84s)
=== RUN   TestAccAWSLaunchConfiguration_withIAMProfile
--- PASS: TestAccAWSLaunchConfiguration_withIAMProfile (64.21s)
=== RUN   TestAccAWSLaunchConfiguration_withEncryption
--- PASS: TestAccAWSLaunchConfiguration_withEncryption (48.94s)
=== RUN   TestAccAWSLaunchConfiguration_updateEbsBlockDevices
--- PASS: TestAccAWSLaunchConfiguration_updateEbsBlockDevices (83.35s)
=== RUN   TestAccAWSLaunchConfiguration_ebs_noDevice
--- PASS: TestAccAWSLaunchConfiguration_ebs_noDevice (45.43s)
=== RUN   TestAccAWSLaunchConfiguration_userData
--- PASS: TestAccAWSLaunchConfiguration_userData (76.23s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	704.454s

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.

Seems happy now -- thanks! 🚀

11 tests passed (all tests)
=== RUN   TestAccAWSLaunchConfiguration_importBasic
--- PASS: TestAccAWSLaunchConfiguration_importBasic (17.43s)
=== RUN   TestAccAWSLaunchConfiguration_withBlockDevices
--- PASS: TestAccAWSLaunchConfiguration_withBlockDevices (18.13s)
=== RUN   TestAccAWSLaunchConfiguration_withSpotPrice
--- PASS: TestAccAWSLaunchConfiguration_withSpotPrice (20.87s)
=== RUN   TestAccAWSLaunchConfiguration_ebs_noDevice
--- PASS: TestAccAWSLaunchConfiguration_ebs_noDevice (21.16s)
=== RUN   TestAccAWSLaunchConfiguration_withVpcClassicLink
--- PASS: TestAccAWSLaunchConfiguration_withVpcClassicLink (22.93s)
=== RUN   TestAccAWSLaunchConfiguration_withEncryption
--- PASS: TestAccAWSLaunchConfiguration_withEncryption (27.54s)
=== RUN   TestAccAWSLaunchConfiguration_basic
--- PASS: TestAccAWSLaunchConfiguration_basic (33.88s)
=== RUN   TestAccAWSLaunchConfiguration_withIAMProfile
--- PASS: TestAccAWSLaunchConfiguration_withIAMProfile (35.36s)
=== RUN   TestAccAWSLaunchConfiguration_updateEbsBlockDevices
--- PASS: TestAccAWSLaunchConfiguration_updateEbsBlockDevices (39.05s)
=== RUN   TestAccAWSLaunchConfiguration_updateRootBlockDevice
--- PASS: TestAccAWSLaunchConfiguration_updateRootBlockDevice (39.63s)
=== RUN   TestAccAWSLaunchConfiguration_userData
--- PASS: TestAccAWSLaunchConfiguration_userData (41.97s)

@bflad bflad merged commit 27429b4 into hashicorp:master Apr 20, 2018
@bflad bflad added this to the v1.16.0 milestone Apr 20, 2018
@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 20, 2018
bflad added a commit that referenced this pull request Apr 20, 2018
@gseyetik
Copy link
Contributor

gseyetik commented Apr 20, 2018

It is not clear to me why the introduction of a new attribute was needed here. The only issue with #2800 was that the "StateFunc" for "user_data" did double encoding of already Base64 encoded data.

To address this issue we could have updated use "StateFunc" for "user_data" to utilize the "userDataHashSum" function.

Except for the one issue from #2800 everything up until this pull request handled both base64 and non-base64 encoded data with one attribute.

The issue in #4197 is fixed by the PR without even using the new attribute as we actually make the StateFunc change here.

@bflad

@loivis loivis deleted the 4197-launch-configuration-user-data branch April 23, 2018 13:25
@bflad
Copy link
Contributor

bflad commented Apr 25, 2018

This has been released in version 1.16.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ibrahima
Copy link

Agree with @gseyetik , the issue I reported is now fixed in v1.16.0 without actually using the new attribute.

@ghost
Copy link

ghost commented Apr 6, 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 Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. size/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS Launch Configuration wants to update user_data despite lack of changes
4 participants