Skip to content

rd/launch_template - add partition_number attribute + validations#11655

Merged
gdavison merged 5 commits into
hashicorp:masterfrom
DrFaust92:launch-template
May 8, 2020
Merged

rd/launch_template - add partition_number attribute + validations#11655
gdavison merged 5 commits into
hashicorp:masterfrom
DrFaust92:launch-template

Conversation

@DrFaust92

@DrFaust92 DrFaust92 commented Jan 18, 2020

Copy link
Copy Markdown
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

resource_aws_launch_template: add `partition_number` attribute
data_source_aws_launch_template: add `partition_number` attribute
aws_launch_template: add plan time validation to `volume_type`, `spot_instance_type`, `ipv6_addresses`, `ipv4_addresses`, `private_ip_address`

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSLaunchTemplate_'
--- PASS: TestAccAWSLaunchTemplate_basic (86.50s)
--- PASS: TestAccAWSLaunchTemplate_data (44.63s)
--- PASS: TestAccAWSLaunchTemplate_description (66.45s)
--- PASS: TestAccAWSLaunchTemplate_update (129.63s)
--- PASS: TestAccAWSLaunchTemplate_tags (78.96s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (71.81s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (62.00s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (112.67s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (39.65s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (40.29s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (34.92s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (105.72s)
--- PASS: TestAccAWSLaunchTemplate_associatePublicIPAddress (194.07s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (102.58s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (99.01s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (316.32s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (118.82s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (117.98s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (66.85s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (155.83s)
--- PASS: TestAccAWSLaunchTemplate_disappears (27.77s)
--- PASS: TestAccAWSLaunchTemplate_placement_partitionNum(52.05s)



--- PASS: TestAccAWSLaunchTemplateDataSource_basic (60.08s)

...

@DrFaust92 DrFaust92 requested a review from a team January 18, 2020 10:38
@ghost ghost added size/S Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jan 18, 2020
@DrFaust92 DrFaust92 changed the title [WIP]launch_template - add host_resource_group_arn and partition_number attributes launch_template - add host_resource_group_arn and partition_number attributes Jan 18, 2020
@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Jan 18, 2020
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 21, 2020
@DrFaust92 DrFaust92 changed the title launch_template - add host_resource_group_arn and partition_number attributes rd/launch_template - add host_resource_group_arn and partition_number attributes Apr 29, 2020

@gdavison gdavison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks great, @DrFaust92. Can you add some testing for the new fields, please?

@gdavison gdavison self-assigned this Apr 30, 2020
@gdavison gdavison added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 30, 2020
@DrFaust92

DrFaust92 commented Apr 30, 2020

Copy link
Copy Markdown
Contributor Author

@gdavison , adding some tests for the partition number argument.

i'll take a look at resource groups as well, may be more tricky

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 30, 2020
`spot_instance_type`, `ipv6_addresses`, `private_ip_address`, `ipv4_addresses`

add test for partition number
@DrFaust92 DrFaust92 changed the title rd/launch_template - add host_resource_group_arn and partition_number attributes rd/launch_template - add partition_number attribute Apr 30, 2020
@DrFaust92 DrFaust92 changed the title rd/launch_template - add partition_number attribute rd/launch_template - add partition_number attribute + validations Apr 30, 2020
@DrFaust92

Copy link
Copy Markdown
Contributor Author

@gdavison dropped host_resource_group_arn from the PR as it requires a dedicated host

@DrFaust92 DrFaust92 requested a review from gdavison April 30, 2020 21:11

@gdavison gdavison left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚀

--- PASS: TestAccAWSLaunchTemplate_disappears (12.45s)
--- PASS: TestAccAWSLaunchTemplate_basic (12.88s)
--- PASS: TestAccAWSLaunchTemplate_cpuOptions (14.32s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_preference (15.21s)
--- PASS: TestAccAWSLaunchTemplate_data (16.08s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_nonBurstable (16.76s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_basic (17.16s)
--- PASS: TestAccAWSLaunchTemplateDataSource_filter_tags (17.28s)
--- PASS: TestAccAWSLaunchTemplateDataSource_basic (17.69s)
--- PASS: TestAccAWSLaunchTemplateDataSource_metadataOptions (17.73s)
--- PASS: TestAccAWSLaunchTemplate_capacityReservation_target (18.52s)
--- PASS: TestAccAWSLaunchTemplate_tags (23.22s)
--- PASS: TestAccAWSLaunchTemplate_description (24.97s)
--- PASS: TestAccAWSLaunchTemplate_ElasticInferenceAccelerator (24.99s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t3 (13.99s)
--- PASS: TestAccAWSLaunchTemplate_metadataOptions (12.99s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses (16.44s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface_ipv6AddressCount (16.43s)
--- PASS: TestAccAWSLaunchTemplate_IamInstanceProfile_EmptyConfigurationBlock (24.58s)
--- PASS: TestAccAWSLaunchTemplate_licenseSpecification (19.92s)
--- PASS: TestAccAWSLaunchTemplate_networkInterface (27.36s)
--- PASS: TestAccAWSLaunchTemplate_networkInterfaceAddresses (27.84s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS (45.10s)
--- PASS: TestAccAWSLaunchTemplate_BlockDeviceMappings_EBS_DeleteOnTermination (45.58s)
--- PASS: TestAccAWSLaunchTemplate_placement_partitionNum (28.76s)
--- PASS: TestAccAWSLaunchTemplate_creditSpecification_t2 (49.69s)
--- PASS: TestAccAWSLaunchTemplate_hibernation (26.35s)
--- PASS: TestAccAWSLaunchTemplate_update (50.94s)
--- PASS: TestAccAWSLaunchTemplateDataSource_associatePublicIPAddress (51.73s)
--- PASS: TestAccAWSLaunchTemplate_associatePublicIPAddress (35.52s)
--- PASS: TestAccAWSLaunchTemplate_EbsOptimized (56.41s)
--- PASS: TestAccAWSLaunchTemplate_instanceMarketOptions (48.02s)

@gdavison gdavison added this to the v2.61.0 milestone May 4, 2020
@breathingdust breathingdust modified the milestones: v2.61.0, v2.62.0 May 8, 2020
@gdavison gdavison merged commit 4b71bbc into hashicorp:master May 8, 2020
gdavison added a commit that referenced this pull request May 8, 2020
@gdavison gdavison modified the milestones: v2.62.0, v2.61.0 May 8, 2020
@ghost

ghost commented May 8, 2020

Copy link
Copy Markdown

This has been released in version 2.61.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!

@Joldnine

Joldnine commented May 8, 2020

Copy link
Copy Markdown

This change will give a default value of 0 to partition_number, causing cluster mode K8S ASG scaling up failure.

@minggaograb

minggaograb commented May 8, 2020

Copy link
Copy Markdown

Hi this MR will break other module like terraform-aws-eks which do not explicitly handle "partition_number". The "partition_number" will become "0" and create following error.
Launching a new EC2 instance. Status Reason: Could not launch Spot Instances. InvalidParameterValue - You cannot use PartitionNumber with a Placement Group that does not exist. Specify a valid Placement Group and try again. Launching EC2 instance failed.
Can we have a default value for "partition_number" rather then 0 when other module do not explicitly handle it?

@Vlaaaaaaad

Copy link
Copy Markdown

We also make use of modules that don't handle partition_number. Since we did a couple applies today, and this broke all ASGs that used LTs.

Pinning the version for the provider fixes this:

provider "aws" {
  version = "<= 2.60.0"

  region = "us-east-1
}

@chancez

chancez commented May 8, 2020

Copy link
Copy Markdown

This seems like a regression.

@BellonXiao

BellonXiao commented May 9, 2020

Copy link
Copy Markdown

I suspect this fix brought another issue:
1 error occurred:
* module.env_reg.module.envreg_cluster.aws_autoscaling_group.autoscaling_group: 1 error occurred:
* aws_autoscaling_group.autoscaling_group: Error creating AutoScaling Group: ValidationError: You must use a valid fully-formed launch template. You cannot use PartitionNumber with a Placement Group that does not exist. Specify a valid Placement Group and try again.

BTW: in our account we don't have any placement group.

@ghost

ghost commented Jun 7, 2020

Copy link
Copy Markdown

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 Jun 7, 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/M 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.

9 participants