-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Enable hibernation attribute for aws_instance resource #6961
Conversation
Any chance we could get this merged in? |
|
@bflad can you take a look and assign if necessary? If not, what are the next steps to get it reviewed? |
Can we get this merged in, please? Is there anything else you need to push this forward? |
This would be so helpful. How soon till it is merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks so much, @hawknewton 🚀
Output from acceptance testing:
--- PASS: TestAccAWSInstance_addSecondaryInterface (109.69s)
--- PASS: TestAccAWSInstance_addSecurityGroupNetworkInterface (120.12s)
--- PASS: TestAccAWSInstance_associatePublic_defaultPrivate (73.96s)
--- PASS: TestAccAWSInstance_associatePublic_defaultPublic (83.95s)
--- PASS: TestAccAWSInstance_associatePublic_explicitPrivate (84.45s)
--- PASS: TestAccAWSInstance_associatePublic_explicitPublic (74.71s)
--- PASS: TestAccAWSInstance_associatePublic_overridePrivate (97.62s)
--- PASS: TestAccAWSInstance_associatePublic_overridePublic (73.20s)
--- PASS: TestAccAWSInstance_associatePublicIPAndPrivateIP (74.22s)
--- PASS: TestAccAWSInstance_basic (126.96s)
--- PASS: TestAccAWSInstance_blockDevices (69.06s)
--- PASS: TestAccAWSInstance_changeInstanceType (232.40s)
--- PASS: TestAccAWSInstance_CreditSpecification_Empty_NonBurstable (320.08s)
--- PASS: TestAccAWSInstance_creditSpecification_isNotAppliedToNonBurstable (130.35s)
--- PASS: TestAccAWSInstance_creditSpecification_standardCpuCredits (87.46s)
--- PASS: TestAccAWSInstance_creditSpecification_standardCpuCredits_t2Tot3Taint (383.24s)
--- PASS: TestAccAWSInstance_creditSpecification_unknownCpuCredits_t2 (175.77s)
--- PASS: TestAccAWSInstance_creditSpecification_unknownCpuCredits_t3 (306.89s)
--- PASS: TestAccAWSInstance_creditSpecification_unlimitedCpuCredits (92.69s)
--- PASS: TestAccAWSInstance_creditSpecification_unlimitedCpuCredits_t2Tot3Taint (393.23s)
--- PASS: TestAccAWSInstance_creditSpecification_unspecifiedDefaultsToStandard (77.06s)
--- PASS: TestAccAWSInstance_CreditSpecification_UnspecifiedToEmpty_NonBurstable (85.28s)
--- PASS: TestAccAWSInstance_creditSpecification_updateCpuCredits (111.39s)
--- PASS: TestAccAWSInstance_creditSpecificationT3_standardCpuCredits (100.13s)
--- PASS: TestAccAWSInstance_creditSpecificationT3_unlimitedCpuCredits (113.80s)
--- PASS: TestAccAWSInstance_creditSpecificationT3_unspecifiedDefaultsToUnlimited (316.99s)
--- PASS: TestAccAWSInstance_creditSpecificationT3_updateCpuCredits (79.30s)
--- PASS: TestAccAWSInstance_disableApiTermination (114.52s)
--- PASS: TestAccAWSInstance_disappears (241.94s)
--- PASS: TestAccAWSInstance_EbsBlockDevice_KmsKeyArn (197.72s)
--- PASS: TestAccAWSInstance_forceNewAndTagsDrift (121.53s)
--- PASS: TestAccAWSInstance_getPasswordData_falseToTrue (150.12s)
--- PASS: TestAccAWSInstance_getPasswordData_trueToFalse (145.68s)
--- PASS: TestAccAWSInstance_GP2IopsDevice (180.23s)
--- PASS: TestAccAWSInstance_GP2WithIopsValue (64.37s)
--- PASS: TestAccAWSInstance_hibernation (266.84s)
--- PASS: TestAccAWSInstance_inDefaultVpcBySgId (72.16s)
--- PASS: TestAccAWSInstance_inDefaultVpcBySgName (193.34s)
--- PASS: TestAccAWSInstance_inEc2Classic (97.33s)
--- PASS: TestAccAWSInstance_instanceProfileChange (157.22s)
--- PASS: TestAccAWSInstance_ipv6_supportAddressCount (83.94s)
--- PASS: TestAccAWSInstance_ipv6_supportAddressCountWithIpv4 (75.08s)
--- PASS: TestAccAWSInstance_ipv6AddressCountAndSingleAddressCausesError (10.04s)
--- PASS: TestAccAWSInstance_keyPairCheck (62.29s)
--- PASS: TestAccAWSInstance_multipleRegions (250.29s)
--- PASS: TestAccAWSInstance_NetworkInstanceRemovingAllSecurityGroups (81.13s)
--- PASS: TestAccAWSInstance_NetworkInstanceSecurityGroups (75.03s)
--- PASS: TestAccAWSInstance_NetworkInstanceVPCSecurityGroupIDs (75.01s)
--- PASS: TestAccAWSInstance_noAMIEphemeralDevices (174.41s)
--- PASS: TestAccAWSInstance_placementGroup (57.37s)
--- PASS: TestAccAWSInstance_primaryNetworkInterface (85.54s)
--- PASS: TestAccAWSInstance_primaryNetworkInterfaceSourceDestCheck (197.04s)
--- PASS: TestAccAWSInstance_privateIP (94.75s)
--- PASS: TestAccAWSInstance_RootBlockDevice_KmsKeyArn (336.53s)
--- PASS: TestAccAWSInstance_rootBlockDeviceMismatch (174.46s)
--- PASS: TestAccAWSInstance_rootInstanceStore (79.53s)
--- PASS: TestAccAWSInstance_sourceDestCheck (112.26s)
--- PASS: TestAccAWSInstance_tags (227.76s)
--- PASS: TestAccAWSInstance_UserData_EmptyStringToUnspecified (87.91s)
--- PASS: TestAccAWSInstance_UserData_UnspecifiedToEmptyString (84.57s)
--- PASS: TestAccAWSInstance_userDataBase64 (140.92s)
--- PASS: TestAccAWSInstance_volumeTags (131.97s)
--- PASS: TestAccAWSInstance_volumeTagsComputed (126.00s)
--- PASS: TestAccAWSInstance_vpc (184.97s)
--- PASS: TestAccAWSInstance_withIamInstanceProfile (103.56s)
--- PASS: TestAccAWSInstanceDataSource_AzUserData (230.72s)
--- PASS: TestAccAWSInstanceDataSource_basic (124.56s)
--- PASS: TestAccAWSInstanceDataSource_blockDevices (101.68s)
--- PASS: TestAccAWSInstanceDataSource_creditSpecification (110.57s)
--- PASS: TestAccAWSInstanceDataSource_EbsBlockDevice_KmsKeyId (134.84s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_falseToTrue (170.51s)
--- PASS: TestAccAWSInstanceDataSource_getPasswordData_trueToFalse (163.32s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData (124.57s)
--- PASS: TestAccAWSInstanceDataSource_GetUserData_NoUserData (121.99s)
--- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (89.18s)
--- PASS: TestAccAWSInstanceDataSource_keyPair (182.73s)
--- PASS: TestAccAWSInstanceDataSource_PlacementGroup (190.15s)
--- PASS: TestAccAWSInstanceDataSource_privateIP (253.61s)
--- PASS: TestAccAWSInstanceDataSource_RootBlockDevice_KmsKeyId (107.90s)
--- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (103.41s)
--- PASS: TestAccAWSInstanceDataSource_SecurityGroups (250.39s)
--- PASS: TestAccAWSInstanceDataSource_tags (242.28s)
--- PASS: TestAccAWSInstanceDataSource_VPC (79.57s)
--- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (83.43s)
--- PASS: TestAccAWSInstancesDataSource_basic (196.96s)
--- PASS: TestAccAWSInstancesDataSource_instance_state_names (191.51s)
--- PASS: TestAccAWSInstancesDataSource_tags (201.39s)
resource "aws_instance" "foo" { | ||
ami = "${aws_ami_copy.encrypted_ami.id}" | ||
instance_type = "m3.medium" | ||
subnet_id = "${aws_subnet.foo.id}" | ||
hibernation = "true" | ||
} | ||
|
||
resource "aws_ami_copy" "encrypted_ami" { | ||
name = "terraform-testacc-encrypted-ami" | ||
description = "An encrypted AMI for Terraform acceptance testing" | ||
source_ami_id = "ami-01e24be29428c15b2" | ||
encrypted = "true" | ||
source_ami_region = "us-west-2" | ||
|
||
tags { | ||
Name = "terraform-testacc-instance-hibernation" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the introduction of this pull request, EC2 now supports launching encrypted EBS volumes from unencrypted AMIs. Will refactor this on merge. 👍
@@ -254,6 +254,12 @@ func resourceAwsInstance() *schema.Resource { | |||
Optional: true, | |||
}, | |||
|
|||
"hibernation": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically we will want to follow the API structure in Terraform (e.g. it would look like the below), however this resource already goes against that in other attributes and this implementation won't prevent that later potential refactoring, so merging this as-is.
resource "aws_instance" "example" {
# ... other configuration ...
hibernation_options {
configured = true
}
}
This has been released in version 2.49.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! |
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! |
This PR relates to #6638.
Changes proposed in this pull request:
hibernation
boolean added toaws_instance
resourceOutput from acceptance testing: