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

r/launch_template: modify default_version #5225

Merged
merged 9 commits into from
Jul 6, 2020

Conversation

kl4w
Copy link
Contributor

@kl4w kl4w commented Jul 17, 2018

Fixes #4655

Changes proposed in this pull request:

  • make default_version attribute modifyable
  • add update_default_version attribute

Output from acceptance testing:

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 (14.93s)
=== RUN   TestAccAWSLaunchTemplate_importData
--- PASS: TestAccAWSLaunchTemplate_importData (13.25s)
=== RUN   TestAccAWSLaunchTemplate_basic
--- PASS: TestAccAWSLaunchTemplate_basic (12.21s)
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (16.13s)
=== RUN   TestAccAWSLaunchTemplate_data
--- PASS: TestAccAWSLaunchTemplate_data (11.60s)
=== RUN   TestAccAWSLaunchTemplate_update
--- PASS: TestAccAWSLaunchTemplate_update (24.52s)
=== RUN   TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_tags (22.95s)
=== RUN   TestAccAWSLaunchTemplate_nonBurstable
--- PASS: TestAccAWSLaunchTemplate_nonBurstable (11.66s)
=== RUN   TestAccAWSLaunchTemplate_defaultVersion
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (22.40s)
=== RUN   TestAccAWSLaunchTemplate_updateDefaultVersion
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (23.51s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	173.215s

@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Jul 17, 2018
@kl4w kl4w changed the title Launch template default version r/launch_template: modify default_version Jul 17, 2018
}
}

if v, vOk := d.GetOk("update_default_version"); vOk && v.(bool) {
Copy link
Member

Choose a reason for hiding this comment

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

I believe if you update only update_default_version in your Terraform configuration (even true to false), the logic above will always call CreateLaunchTemplateVersion. We should prevent this behavior and verify this doesn't occur.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh yes, I'll take a look at this and reply back once it's complete

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. waiting-response Maintainers are waiting on response from community or contributor. service/ec2 Issues and PRs that pertain to the ec2 service. labels Jul 17, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Jul 18, 2018
@kl4w
Copy link
Contributor Author

kl4w commented Jul 18, 2018

@bflad made some changes. It looks a bit clunky to me so appreciate any input.

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.99s)
=== RUN   TestAccAWSLaunchTemplate_importData
--- PASS: TestAccAWSLaunchTemplate_importData (13.85s)
=== RUN   TestAccAWSLaunchTemplate_basic
--- PASS: TestAccAWSLaunchTemplate_basic (13.03s)
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (15.68s)
=== RUN   TestAccAWSLaunchTemplate_data
--- PASS: TestAccAWSLaunchTemplate_data (11.47s)
=== RUN   TestAccAWSLaunchTemplate_update
--- PASS: TestAccAWSLaunchTemplate_update (23.59s)
=== RUN   TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_tags (23.36s)
=== RUN   TestAccAWSLaunchTemplate_nonBurstable
--- PASS: TestAccAWSLaunchTemplate_nonBurstable (12.21s)
=== RUN   TestAccAWSLaunchTemplate_defaultVersion
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (24.93s)
=== RUN   TestAccAWSLaunchTemplate_updateDefaultVersion
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (23.20s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	175.367s

@bflad bflad removed the waiting-response Maintainers are waiting on response from community or contributor. label Jul 18, 2018
@calvcoll
Copy link

Is there any way of speeding up this pull request, if I were to fix the merge conflict would I need to create a new PR including this work?

@kl4w kl4w force-pushed the launch-template-default-version branch from ae82070 to 7c7d127 Compare August 30, 2018 14:12
@kl4w
Copy link
Contributor Author

kl4w commented Aug 30, 2018

@calvcoll @bflad rebased

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.62s)
=== RUN   TestAccAWSLaunchTemplate_importData
--- PASS: TestAccAWSLaunchTemplate_importData (11.25s)
=== RUN   TestAccAWSLaunchTemplate_basic
--- PASS: TestAccAWSLaunchTemplate_basic (12.18s)
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (14.05s)
=== RUN   TestAccAWSLaunchTemplate_data
--- PASS: TestAccAWSLaunchTemplate_data (10.68s)
=== RUN   TestAccAWSLaunchTemplate_update
--- PASS: TestAccAWSLaunchTemplate_update (45.70s)
=== RUN   TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_tags (20.78s)
=== RUN   TestAccAWSLaunchTemplate_nonBurstable
--- PASS: TestAccAWSLaunchTemplate_nonBurstable (11.22s)
=== RUN   TestAccAWSLaunchTemplate_networkInterface
--- PASS: TestAccAWSLaunchTemplate_networkInterface (28.47s)
=== RUN   TestAccAWSLaunchTemplate_defaultVersion
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (20.69s)
=== RUN   TestAccAWSLaunchTemplate_updateDefaultVersion
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (19.73s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	208.428s

@kl4w kl4w force-pushed the launch-template-default-version branch from 7c7d127 to e5d52ab Compare August 30, 2018 14:29
@calvcoll
Copy link

@kl4w Thanks!

@rohityadav225
Copy link

Is there a release date for this PR ?

@sj26
Copy link
Contributor

sj26 commented Oct 8, 2018

This seems like a critical piece of missing functionality to make launch templates truly useful, please consider integrating.

@andybkay
Copy link

Do we know when this will be merged?

@luis-silva
Copy link

luis-silva commented Feb 26, 2019

@kl4w Can you bring this branch up to date to see if we can get this merged?

@kl4w kl4w force-pushed the launch-template-default-version branch from e5d52ab to 8a3a042 Compare February 27, 2019 22:54
@ghost ghost added documentation Introduces or discusses updates to documentation. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/L Managed by automation to categorize the size of a PR. labels Feb 27, 2019
@kl4w
Copy link
Contributor Author

kl4w commented Feb 27, 2019

rebased

make testacc TEST=./aws TESTARGS='-run=TestAccAWSEcsService_'
==> Fixing source code with gofmt...
gofmt -s -w ./aws
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSEcsService_ -timeout 120m
=== RUN   TestAccAWSEcsService_withARN
=== PAUSE TestAccAWSEcsService_withARN
=== RUN   TestAccAWSEcsService_basicImport
=== PAUSE TestAccAWSEcsService_basicImport
=== RUN   TestAccAWSEcsService_disappears
=== PAUSE TestAccAWSEcsService_disappears
=== RUN   TestAccAWSEcsService_withUnnormalizedPlacementStrategy
=== PAUSE TestAccAWSEcsService_withUnnormalizedPlacementStrategy
=== RUN   TestAccAWSEcsService_withFamilyAndRevision
=== PAUSE TestAccAWSEcsService_withFamilyAndRevision
=== RUN   TestAccAWSEcsService_withRenamedCluster
=== PAUSE TestAccAWSEcsService_withRenamedCluster
=== RUN   TestAccAWSEcsService_healthCheckGracePeriodSeconds
=== PAUSE TestAccAWSEcsService_healthCheckGracePeriodSeconds
=== RUN   TestAccAWSEcsService_withIamRole
=== PAUSE TestAccAWSEcsService_withIamRole
=== RUN   TestAccAWSEcsService_withDeploymentController_Type_CodeDeploy
=== PAUSE TestAccAWSEcsService_withDeploymentController_Type_CodeDeploy
=== RUN   TestAccAWSEcsService_withDeploymentValues
=== PAUSE TestAccAWSEcsService_withDeploymentValues
=== RUN   TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred
=== PAUSE TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred
=== RUN   TestAccAWSEcsService_withLbChanges
=== PAUSE TestAccAWSEcsService_withLbChanges
=== RUN   TestAccAWSEcsService_withEcsClusterName
=== PAUSE TestAccAWSEcsService_withEcsClusterName
=== RUN   TestAccAWSEcsService_withAlb
=== PAUSE TestAccAWSEcsService_withAlb
=== RUN   TestAccAWSEcsService_withPlacementStrategy
=== PAUSE TestAccAWSEcsService_withPlacementStrategy
=== RUN   TestAccAWSEcsService_withPlacementConstraints
=== PAUSE TestAccAWSEcsService_withPlacementConstraints
=== RUN   TestAccAWSEcsService_withPlacementConstraints_emptyExpression
=== PAUSE TestAccAWSEcsService_withPlacementConstraints_emptyExpression
=== RUN   TestAccAWSEcsService_withLaunchTypeFargate
=== PAUSE TestAccAWSEcsService_withLaunchTypeFargate
=== RUN   TestAccAWSEcsService_withLaunchTypeFargateAndPlatformVersion
=== PAUSE TestAccAWSEcsService_withLaunchTypeFargateAndPlatformVersion
=== RUN   TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration
=== PAUSE TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration
=== RUN   TestAccAWSEcsService_withDaemonSchedulingStrategy
=== PAUSE TestAccAWSEcsService_withDaemonSchedulingStrategy
=== RUN   TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum
=== PAUSE TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum
=== RUN   TestAccAWSEcsService_withReplicaSchedulingStrategy
=== PAUSE TestAccAWSEcsService_withReplicaSchedulingStrategy
=== RUN   TestAccAWSEcsService_withServiceRegistries
=== PAUSE TestAccAWSEcsService_withServiceRegistries
=== RUN   TestAccAWSEcsService_withServiceRegistries_container
=== PAUSE TestAccAWSEcsService_withServiceRegistries_container
=== RUN   TestAccAWSEcsService_Tags
=== PAUSE TestAccAWSEcsService_Tags
=== RUN   TestAccAWSEcsService_ManagedTags
=== PAUSE TestAccAWSEcsService_ManagedTags
=== RUN   TestAccAWSEcsService_PropagateTags
=== PAUSE TestAccAWSEcsService_PropagateTags
=== CONT  TestAccAWSEcsService_withARN
=== CONT  TestAccAWSEcsService_withPlacementConstraints
=== CONT  TestAccAWSEcsService_withLbChanges
=== CONT  TestAccAWSEcsService_healthCheckGracePeriodSeconds
=== CONT  TestAccAWSEcsService_withAlb
=== CONT  TestAccAWSEcsService_withPlacementStrategy
=== CONT  TestAccAWSEcsService_withFamilyAndRevision
=== CONT  TestAccAWSEcsService_withIamRole
=== CONT  TestAccAWSEcsService_withDeploymentController_Type_CodeDeploy
=== CONT  TestAccAWSEcsService_withEcsClusterName
--- PASS: TestAccAWSEcsService_withPlacementConstraints (19.59s)
=== CONT  TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration
--- PASS: TestAccAWSEcsService_withARN (23.34s)
=== CONT  TestAccAWSEcsService_withReplicaSchedulingStrategy
--- PASS: TestAccAWSEcsService_withReplicaSchedulingStrategy (12.88s)
=== CONT  TestAccAWSEcsService_PropagateTags
--- PASS: TestAccAWSEcsService_withEcsClusterName (40.29s)
=== CONT  TestAccAWSEcsService_ManagedTags
--- PASS: TestAccAWSEcsService_withPlacementStrategy (50.03s)
=== CONT  TestAccAWSEcsService_Tags
--- PASS: TestAccAWSEcsService_withFamilyAndRevision (54.35s)
=== CONT  TestAccAWSEcsService_withServiceRegistries_container
--- PASS: TestAccAWSEcsService_ManagedTags (15.37s)
=== CONT  TestAccAWSEcsService_withServiceRegistries
--- PASS: TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration (73.76s)
=== CONT  TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred
--- PASS: TestAccAWSEcsService_Tags (45.84s)
=== CONT  TestAccAWSEcsService_disappears
--- PASS: TestAccAWSEcsService_disappears (15.37s)
=== CONT  TestAccAWSEcsService_withUnnormalizedPlacementStrategy
--- PASS: TestAccAWSEcsService_PropagateTags (77.31s)
=== CONT  TestAccAWSEcsService_withDeploymentValues
--- PASS: TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred (33.01s)
=== CONT  TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum (17.07s)
=== CONT  TestAccAWSEcsService_withDaemonSchedulingStrategy
--- PASS: TestAccAWSEcsService_withUnnormalizedPlacementStrategy (34.20s)
=== CONT  TestAccAWSEcsService_basicImport
--- PASS: TestAccAWSEcsService_withDeploymentValues (33.87s)
=== CONT  TestAccAWSEcsService_withLaunchTypeFargate
--- PASS: TestAccAWSEcsService_basicImport (30.61s)
=== CONT  TestAccAWSEcsService_withLaunchTypeFargateAndPlatformVersion
--- PASS: TestAccAWSEcsService_withDaemonSchedulingStrategy (36.19s)
=== CONT  TestAccAWSEcsService_withPlacementConstraints_emptyExpression
--- PASS: TestAccAWSEcsService_withServiceRegistries_container (133.52s)
=== CONT  TestAccAWSEcsService_withRenamedCluster
--- PASS: TestAccAWSEcsService_withLbChanges (189.05s)
--- PASS: TestAccAWSEcsService_withServiceRegistries (133.84s)
--- PASS: TestAccAWSEcsService_withPlacementConstraints_emptyExpression (12.78s)
--- PASS: TestAccAWSEcsService_withIamRole (216.24s)
--- PASS: TestAccAWSEcsService_withDeploymentController_Type_CodeDeploy (229.55s)
--- PASS: TestAccAWSEcsService_withRenamedCluster (44.31s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargate (98.10s)
--- PASS: TestAccAWSEcsService_withAlb (256.88s)
--- PASS: TestAccAWSEcsService_withLaunchTypeFargateAndPlatformVersion (88.15s)
--- PASS: TestAccAWSEcsService_healthCheckGracePeriodSeconds (300.65s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	300.699s

@luis-silva
Copy link

@bflad Could you check this PR and merge it if everything looks good? Or just lets us know what else is needed to get this out the door. Thanks!

@aeschright aeschright requested a review from a team June 25, 2019 21:25
@anGie44
Copy link
Contributor

anGie44 commented Jun 8, 2020

hi @kl4w, thank you again for this contribution and your diligence in keeping your PR up-to-date! Given more recent changes in the codebase, do you mind rebasing again?

@anGie44 anGie44 added the waiting-response Maintainers are waiting on response from community or contributor. label Jun 8, 2020
@kl4w kl4w force-pushed the launch-template-default-version branch from 70e7cf5 to 60a01b1 Compare June 26, 2020 16:19
@kl4w
Copy link
Contributor Author

kl4w commented Jun 26, 2020

@anGie44 apologies for the late reply. it's been a long while since I've played around with launch_templates as well as this PR. I've rebased and below are the tests and the outputs.

Due to how long it's been since I've viewed this PR, I'm not 100% confident in the behaviour and more testing should be done. Happy to add more, I just need some time to refresh my memory.

The failure in the test below is due my test AWS account.

make testacc TEST=./aws TESTARGS='-run=TestAccAWSLaunchTemplate_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLaunchTemplate_ -timeout 120m
=== RUN   TestAccAWSLaunchTemplate_basic
=== PAUSE TestAccAWSLaunchTemplate_basic
=== RUN   TestAccAWSLaunchTemplate_disappears
=== PAUSE TestAccAWSLaunchTemplate_disappears
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
=== PAUSE TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
=== RUN   TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination
=== PAUSE TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination
=== RUN   TestAccAWSLaunchTemplate_EbsOptimized
=== PAUSE TestAccAWSLaunchTemplate_EbsOptimized
=== RUN   TestAccAWSLaunchTemplate_ElasticInferenceAccelerator
=== PAUSE TestAccAWSLaunchTemplate_ElasticInferenceAccelerator
=== RUN   TestAccAWSLaunchTemplate_data
=== PAUSE TestAccAWSLaunchTemplate_data
=== RUN   TestAccAWSLaunchTemplate_description
=== PAUSE TestAccAWSLaunchTemplate_description
=== RUN   TestAccAWSLaunchTemplate_update
=== PAUSE TestAccAWSLaunchTemplate_update
=== RUN   TestAccAWSLaunchTemplate_tags
=== PAUSE TestAccAWSLaunchTemplate_tags
=== RUN   TestAccAWSLaunchTemplate_capacityReservation_preference
=== PAUSE TestAccAWSLaunchTemplate_capacityReservation_preference
=== RUN   TestAccAWSLaunchTemplate_capacityReservation_target
=== PAUSE TestAccAWSLaunchTemplate_capacityReservation_target
=== RUN   TestAccAWSLaunchTemplate_cpuOptions
=== PAUSE TestAccAWSLaunchTemplate_cpuOptions
=== RUN   TestAccAWSLaunchTemplate_creditSpecification_nonBurstable
=== PAUSE TestAccAWSLaunchTemplate_creditSpecification_nonBurstable
=== RUN   TestAccAWSLaunchTemplate_creditSpecification_t2
=== PAUSE TestAccAWSLaunchTemplate_creditSpecification_t2
=== RUN   TestAccAWSLaunchTemplate_creditSpecification_t3
=== PAUSE TestAccAWSLaunchTemplate_creditSpecification_t3
=== RUN   TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
=== PAUSE TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
=== RUN   TestAccAWSLaunchTemplate_networkInterface
=== PAUSE TestAccAWSLaunchTemplate_networkInterface
=== RUN   TestAccAWSLaunchTemplate_networkInterfaceAddresses
=== PAUSE TestAccAWSLaunchTemplate_networkInterfaceAddresses
=== RUN   TestAccAWSLaunchTemplate_associatePublicIPAddress
=== PAUSE TestAccAWSLaunchTemplate_associatePublicIPAddress
=== RUN   TestAccAWSLaunchTemplate_placement_partitionNum
=== PAUSE TestAccAWSLaunchTemplate_placement_partitionNum
=== RUN   TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses
=== PAUSE TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses
=== RUN   TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount
=== PAUSE TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount
=== RUN   TestAccAWSLaunchTemplate_instanceMarketOptions
=== PAUSE TestAccAWSLaunchTemplate_instanceMarketOptions
=== RUN   TestAccAWSLaunchTemplate_licenseSpecification
=== PAUSE TestAccAWSLaunchTemplate_licenseSpecification
=== RUN   TestAccAWSLaunchTemplate_metadataOptions
=== PAUSE TestAccAWSLaunchTemplate_metadataOptions
=== RUN   TestAccAWSLaunchTemplate_hibernation
=== PAUSE TestAccAWSLaunchTemplate_hibernation
=== RUN   TestAccAWSLaunchTemplate_defaultVersion
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (58.58s)
=== RUN   TestAccAWSLaunchTemplate_updateDefaultVersion
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (58.97s)
=== CONT  TestAccAWSLaunchTemplate_basic
=== CONT  TestAccAWSLaunchTemplate_creditSpecification_t2
=== CONT  TestAccAWSLaunchTemplate_metadataOptions
=== CONT  TestAccAWSLaunchTemplate_licenseSpecification
=== CONT  TestAccAWSLaunchTemplate_networkInterface
=== CONT  TestAccAWSLaunchTemplate_description
=== CONT  TestAccAWSLaunchTemplate_instanceMarketOptions
=== CONT  TestAccAWSLaunchTemplate_creditSpecification_t3
=== CONT  TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock
=== CONT  TestAccAWSLaunchTemplate_EbsOptimized
=== CONT  TestAccAWSLaunchTemplate_associatePublicIPAddress
=== CONT  TestAccAWSLaunchTemplate_placement_partitionNum
=== CONT  TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS
=== CONT  TestAccAWSLaunchTemplate_capacityReservation_target
=== CONT  TestAccAWSLaunchTemplate_creditSpecification_nonBurstable
=== CONT  TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount
=== CONT  TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination
=== CONT  TestAccAWSLaunchTemplate_disappears
=== CONT  TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses
=== CONT  TestAccAWSLaunchTemplate_hibernation
    TestAccAWSLaunchTemplate_licenseSpecification: testing.go:684: Step 0 error: errors during apply:

        Error: Error creating License Manager license configuration: AccessDeniedException: Service role not found. Consult setup procedures in License Manager User Guide and create the required role for the service.

          on /var/folders/dh/0jdfw6b944q1cb1kvt5_xryw0000gn/T/tf-test626410951/main.tf line 2:
          (source code not available)


--- FAIL: TestAccAWSLaunchTemplate_licenseSpecification (5.19s)
=== CONT  TestAccAWSLaunchTemplate_capacityReservation_preference
--- PASS: TestAccAWSLaunchTemplate_disappears (13.89s)
=== CONT  TestAccAWSLaunchTemplate_tags
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (17.95s)
=== CONT  TestAccAWSLaunchTemplate_update
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (19.66s)
=== CONT  TestAccAWSLaunchTemplate_networkInterfaceAddresses
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (19.90s)
=== CONT  TestAccAWSLaunchTemplate_data
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (19.98s)
=== CONT  TestAccAWSLaunchTemplate_ElasticInferenceAccelerator
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (20.11s)
=== CONT  TestAccAWSLaunchTemplate_cpuOptions
--- PASS: TestAccAWSLaunchTemplate_basic (20.25s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (20.27s)
--- PASS: TestAccAWSLaunchTemplate_metadataOptions (20.35s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (19.30s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (24.85s)
--- PASS: TestAccAWSLaunchTemplate_description (32.93s)
--- PASS: TestAccAWSLaunchTemplate_cpuOptions (16.42s)
--- PASS: TestAccAWSLaunchTemplate_placement_partitionNum (38.25s)
--- PASS: TestAccAWSLaunchTemplate_data (19.71s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (42.09s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (45.61s)
--- PASS: TestAccAWSLaunchTemplate_hibernation (47.56s)
--- PASS: TestAccAWSLaunchTemplate_tags (34.34s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (32.29s)
--- PASS: TestAccAWSLaunchTemplate_networkInterfaceAddresses (40.76s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (73.39s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (80.35s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (83.20s)
--- PASS: TestAccAWSLaunchTemplate_associatePublicIPAddress (87.33s)
--- PASS: TestAccAWSLaunchTemplate_update (79.53s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-aws/aws	216.529s
FAIL
make: *** [testacc] Error 1

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Jun 26, 2020
@anGie44
Copy link
Contributor

anGie44 commented Jun 26, 2020

No worries @kl4w, thanks for commenting back here! overall the behavior looks good, I did a bit of refactoring with what you last committed and updated the test cases to use the new map syntax for tags since there was some test breakage there as well as updated the name attribute passed to the launch_template test configs since the naming was triggering the ForceNew behavior instead of Update. let me know what you think as well or if any questions arise!

Before you just rebased, I ran the tests again and they looked 👍 will re-run them and comment back here if any more changes are needed :)

Update: Output of acceptance tests:

--- PASS: TestAccAWSLaunchTemplate_disappears (14.94s)
--- PASS: TestAccAWSLaunchTemplate_cpuOptions (16.54s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (18.36s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_basic (19.34s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (19.35s)
--- PASS: TestAccAWSLaunchTemplate_basic (19.66s)
--- PASS: TestAccAWSLaunchTemplate_data (19.76s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (20.48s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (20.81s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_tags (20.43s)
--- PASS: TestAccAWSLaunchTemplateDataSource_basic (20.89s)
--- PASS: TestAccAWSLaunchTemplateDataSource_metadataOptions (20.84s)
--- PASS: TestAccAWSLaunchTemplate_description (29.24s)
--- PASS: TestAccAWSLaunchTemplate_tags (30.84s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (16.04s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (15.56s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (20.45s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (37.36s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (16.67s)
--- PASS: TestAccAWSLaunchTemplate_metadataOptions (17.09s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (18.73s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (22.57s)
--- PASS: TestAccAWSLaunchTemplateDataSource_associatePublicIPAddress (43.59s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (44.05s)
--- PASS: TestAccAWSLaunchTemplate_update (46.89s)
--- PASS: TestAccAWSLaunchTemplate_networkInterfaceAddresses (28.32s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (49.09s)
--- PASS: TestAccAWSLaunchTemplate_placement_partitionNum (29.61s)
--- PASS: TestAccAWSLaunchTemplate_hibernation (29.37s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (50.48s)
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (30.65s)
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (32.59s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (48.94s)
--- PASS: TestAccAWSLaunchTemplate_associatePublicIPAddress (54.19s)

Copy link
Member

@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 @kl4w and @anGie44 👋 Thank for you working on this functionality! Its pretty non-trivial since there are multiple things happening during potential updates. I left some initial feedback below with what I would consider the correct behavior here, but please do reach out if you think I'm wrong or if you have any questions. 👍

aws/resource_aws_launch_template.go Show resolved Hide resolved
aws/resource_aws_launch_template.go Outdated Show resolved Hide resolved
aws/resource_aws_launch_template_test.go Outdated Show resolved Hide resolved
aws/resource_aws_launch_template_test.go Outdated Show resolved Hide resolved
aws/resource_aws_launch_template_test.go Show resolved Hide resolved
aws/resource_aws_launch_template_test.go Outdated Show resolved Hide resolved
aws/resource_aws_launch_template_test.go Outdated Show resolved Hide resolved
aws/resource_aws_launch_template.go Show resolved Hide resolved
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Jul 2, 2020
@anGie44 anGie44 force-pushed the launch-template-default-version branch 2 times, most recently from c24a3cd to 7104da7 Compare July 2, 2020 16:53
@anGie44 anGie44 requested a review from bflad July 2, 2020 16:55
@anGie44 anGie44 force-pushed the launch-template-default-version branch from 7104da7 to 4d1f5c1 Compare July 2, 2020 19:15
@anGie44 anGie44 force-pushed the launch-template-default-version branch 2 times, most recently from b5a1a77 to b75b3b0 Compare July 2, 2020 20:17
@anGie44 anGie44 force-pushed the launch-template-default-version branch from b75b3b0 to 2be2311 Compare July 2, 2020 20:33
@anGie44
Copy link
Contributor

anGie44 commented Jul 2, 2020

Output of re-run acceptance tests: @bflad

--- PASS: TestAccAWSLaunchTemplate_disappears (17.20s)
--- PASS: TestAccAWSLaunchTemplate_cpuOptions (19.14s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (21.57s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (21.81s)
--- PASS: TestAccAWSLaunchTemplateDataSource_metadataOptions (21.74s)
--- PASS: TestAccAWSLaunchTemplateDataSource_basic (22.13s)
--- PASS: TestAccAWSLaunchTemplate_basic (22.28s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (22.15s)
--- PASS: TestAccAWSLaunchTemplate_data (21.84s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_tags (22.51s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_basic (22.55s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (24.24s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (30.99s)
--- PASS: TestAccAWSLaunchTemplate_description (31.56s)
--- PASS: TestAccAWSLaunchTemplate_tags (33.12s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (19.08s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (16.80s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (16.91s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (18.66s)
--- PASS: TestAccAWSLaunchTemplate_networkInterfaceAddresses (22.93s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (45.07s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (25.31s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (23.32s)
--- PASS: TestAccAWSLaunchTemplate_metadataOptions (25.32s)
--- PASS: TestAccAWSLaunchTemplateDataSource_associatePublicIPAddress (48.63s)
--- PASS: TestAccAWSLaunchTemplate_placement_partitionNum (26.92s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (52.67s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (54.01s)
--- PASS: TestAccAWSLaunchTemplate_hibernation (30.01s)
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (25.52s)
--- PASS: TestAccAWSLaunchTemplate_associatePublicIPAddress (40.41s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (48.22s)
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (38.74s)
--- PASS: TestAccAWSLaunchTemplate_update (78.57s)

Copy link
Member

@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.

Otherwise, LGTM 🚀

Output from acceptance testing:

--- PASS: TestAccAWSLaunchTemplate_disappears (15.58s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (19.99s)
--- PASS: TestAccAWSLaunchTemplate_cpuOptions (20.86s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (21.77s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (21.75s)
--- PASS: TestAccAWSLaunchTemplateDataSource_basic (21.59s)
--- PASS: TestAccAWSLaunchTemplate_basic (21.90s)
--- PASS: TestAccAWSLaunchTemplate_data (21.83s)
--- PASS: TestAccAWSLaunchTemplateDataSource_metadataOptions (22.27s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_basic (22.24s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_tags (23.14s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (24.22s)
--- PASS: TestAccAWSLaunchTemplate_tags (31.66s)
--- PASS: TestAccAWSLaunchTemplate_description (32.87s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (33.11s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (20.08s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (15.56s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (17.96s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (18.40s)
--- PASS: TestAccAWSLaunchTemplate_metadataOptions (17.86s)
--- PASS: TestAccAWSLaunchTemplateDataSource_associatePublicIPAddress (42.82s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (21.59s)
--- PASS: TestAccAWSLaunchTemplate_networkInterfaceAddresses (23.89s)
--- PASS: TestAccAWSLaunchTemplate_placement_partitionNum (25.46s)
--- PASS: TestAccAWSLaunchTemplate_update (51.67s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (52.53s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (52.75s)
--- PASS: TestAccAWSLaunchTemplate_hibernation (30.33s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (56.29s)
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (29.33s)
--- PASS: TestAccAWSLaunchTemplate_associatePublicIPAddress (38.54s)
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (32.46s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (50.10s)

aws/resource_aws_launch_template_test.go Outdated Show resolved Hide resolved
@anGie44
Copy link
Contributor

anGie44 commented Jul 6, 2020

configuring update_default_version = true and running terraform apply to promote the default version to match the latest version, without other changes or needing to lookup the latest and configure default_version = 123 explicitly.

Added handling of the above use-case, such that latest version is determined at Update time.
Output of acceptance tests:

--- PASS: TestAccAWSLaunchTemplate_disappears (16.88s)
--- PASS: TestAccAWSLaunchTemplate_data (17.15s)
--- PASS: TestAccAWSLaunchTemplate_cpuOptions (18.89s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (20.19s)
--- PASS: TestAccAWSLaunchTemplate_basic (20.62s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (20.95s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (21.56s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (22.14s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_tags (22.24s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_basic (22.52s)
--- PASS: TestAccAWSLaunchTemplateDataSource_metadataOptions (22.56s)
--- PASS: TestAccAWSLaunchTemplateDataSource_basic (23.03s)
--- PASS: TestAccAWSLaunchTemplate_tags (31.99s)
--- PASS: TestAccAWSLaunchTemplate_description (31.91s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (14.49s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (20.63s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (15.51s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (37.93s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (16.20s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (22.99s)
--- PASS: TestAccAWSLaunchTemplate_metadataOptions (18.50s)
--- PASS: TestAccAWSLaunchTemplate_networkInterfaceAddresses (23.23s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (25.48s)
--- PASS: TestAccAWSLaunchTemplateDataSource_associatePublicIPAddress (46.09s)
--- PASS: TestAccAWSLaunchTemplate_update (49.22s)
--- PASS: TestAccAWSLaunchTemplate_placement_partitionNum (30.30s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (52.58s)
--- PASS: TestAccAWSLaunchTemplate_defaultVersion (25.77s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (58.99s)
--- PASS: TestAccAWSLaunchTemplate_hibernation (37.58s)
--- PASS: TestAccAWSLaunchTemplate_updateDefaultVersion (28.78s)
--- PASS: TestAccAWSLaunchTemplate_associatePublicIPAddress (40.03s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (48.15s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (82.44s)

@anGie44 anGie44 merged commit cbd0137 into hashicorp:master Jul 6, 2020
@anGie44 anGie44 added this to the v2.70.0 milestone Jul 6, 2020
anGie44 added a commit that referenced this pull request Jul 6, 2020
@ghost
Copy link

ghost commented Jul 10, 2020

This has been released in version 2.70.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
Copy link

ghost commented Aug 5, 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 Aug 5, 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/ec2 Issues and PRs that pertain to the ec2 service. size/XL 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.

Add ability to set default version of aws_launch_template
8 participants