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

Add support for managing ebs default encryption #8760

Closed
devonbleak opened this issue May 23, 2019 · 10 comments · Fixed by #8771
Closed

Add support for managing ebs default encryption #8760

devonbleak opened this issue May 23, 2019 · 10 comments · Fixed by #8771
Labels
new-resource Introduces a new resource. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@devonbleak
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS has released the ability to encrypt all new EBS volumes by default, however it is opt-in. It would be great to be able to manage the related settings in TF.

New or Affected Resource(s)

Proposed new resource: aws_ebs_encryption_by_default

Potential Terraform Configuration

resource "aws_ebs_encryption_by_default" "ebs" {
  enabled    = true
  kms_key_id = "${aws_kms_key.default_ebs_key.arn}"
}

Both arguments are optional.

Default value for enabled is true. Setting it false or destroying the resource will disable EBS encryption by default.

Removing the kms_key_id or destroying the resource will reset the KMS key ID to the default EBS key.

References

https://aws.amazon.com/blogs/aws/new-opt-in-to-default-encryption-for-new-ebs-volumes/

@devonbleak devonbleak added the enhancement Requests to existing resources that expand the functionality or scope. label May 23, 2019
@ewbankkit
Copy link
Contributor

Requires:

@ewbankkit
Copy link
Contributor

Maybe cleaner to have 2 new resources, one for managing the EBS encryption-by-default value and one for managing the default EBS encryption key as there are two distinct sets of EC2 APIs for these?
e.g.

resource "aws_ebs_encryption_by_default" "ebs" {
  enabled = true
}

resource "aws_ebs_default_kms_key" "ebs" {
  key_id = "${aws_kms_key.default_ebs_key.arn}"
}

@ewbankkit
Copy link
Contributor

We need this one so I'll take it on if nobody else has started.

@devonbleak
Copy link
Contributor Author

@ewbankkit I haven't started on it.

Regarding splitting into 2 resources I would just make it clear in the docs that setting the default key does not actually enable the default encryption.

@ewbankkit
Copy link
Contributor

It will probably be useful to have data sources for these two as well. I'll open another issue.

@jukie
Copy link
Contributor

jukie commented May 31, 2019

What value would a data source for aws_ebs_encryption_by_default add and what would the potential parameters be?

Adding a data source for the kms key seems very useful and I'd like to work on that at least but could you clarify your thoughts behind adding one for aws_ebs_encryption_by_default @ewbankkit ?

@ewbankkit
Copy link
Contributor

@jukie The value would be that subsequent resources could be conditionally created based on the value of "${data.aws_ebs_encryption_by_default.ebs.enabled}".

@bflad bflad added new-resource Introduces a new resource. service/ec2 Issues and PRs that pertain to the ec2 service. and removed enhancement Requests to existing resources that expand the functionality or scope. labels Jun 6, 2019
@bflad bflad modified the milestones: v2.14.0, v2.15.0 Jun 6, 2019
@bflad bflad modified the milestones: v2.15.0, v2.16.0 Jun 13, 2019
@bflad
Copy link
Contributor

bflad commented Jun 20, 2019

Two new resources for managing EBS encryption defaults (aws_ebs_default_kms_key and
aws_ebs_encryption_by_default) have been merged and will release with version 2.16.0 of the Terraform AWS Provider, likely tomorrow. 👍 Thanks to @ewbankkit!

@bflad
Copy link
Contributor

bflad commented Jun 20, 2019

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

@ghost
Copy link

ghost commented Nov 3, 2019

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 Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants