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/aws_efs_file_system: Add support for encryption #1420

Merged
merged 9 commits into from
Aug 17, 2017

Conversation

pavloos
Copy link
Contributor

@pavloos pavloos commented Aug 15, 2017

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSEFSFileSystem_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSEFSFileSystem_ -timeout 120m
=== RUN   TestAccAWSEFSFileSystem_importBasic
--- PASS: TestAccAWSEFSFileSystem_importBasic (50.69s)
=== RUN   TestAccAWSEFSFileSystem_basic
--- PASS: TestAccAWSEFSFileSystem_basic (113.40s)
=== RUN   TestAccAWSEFSFileSystem_pagedTags
--- PASS: TestAccAWSEFSFileSystem_pagedTags (48.26s)
=== RUN   TestAccAWSEFSFileSystem_KmsKey
--- PASS: TestAccAWSEFSFileSystem_KmsKey (87.40s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	299.772s

@grubernaut grubernaut added the enhancement Requests to existing resources that expand the functionality or scope. label Aug 15, 2017
Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Hey @pjfbashton

Thanks for the work here!
Just left a few comments to address before merging.

Nice work for a first contribution! 👍


func testAccAWSEFSFileSystemConfigWithKmsKey(rInt int) string {
return fmt.Sprintf(`
resource "aws_kms_key" "foo" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you stick lines to the left with an indentation of 2 spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually dont think we need that policy at all, test runs fine without it so I removed it


if v, ok := d.GetOk("kms_key_id"); ok {
createOpts.KmsKeyId = aws.String(v.(string))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should check that Encrypted is true if KmsKeyId is set, and catch the related Exception if the API call is made (BadRequest perhaps?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking into this now, thanks ;)

"aws_efs_file_system.foo-with-kms",
"kms_key_id",
keyRegex,
),
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also check that encrypted is well set here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good call. Check added

}

resource "aws_efs_file_system" "foo-with-kms" {
encrypted = true
Copy link
Contributor

Choose a reason for hiding this comment

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

encrypted should be aligned with kms_key_id

Pawel Fiuto added 3 commits August 17, 2017 09:19
@Ninir Ninir added the waiting-response Maintainers are waiting on response from community or contributor. label Aug 17, 2017
@pavloos
Copy link
Contributor Author

pavloos commented Aug 17, 2017

@Ninir seems that KmsKeyId is ignored by sdk when Encrypted is false so I added a check that will throw an error if encrypted is not true when kms_key_id is specified. would that work?

Copy link
Contributor

@Ninir Ninir left a comment

Choose a reason for hiding this comment

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

Hey @pjfbashton

Made a few modifications of your work, so that it can be merged. For the record, added another acceptance test that actually checks the error you implemented, when encrypted is false and the kms key is defined.

$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSEFSFileSystem_'   
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSEFSFileSystem_ -timeout 120m
=== RUN   TestAccAWSEFSFileSystem_importBasic
--- PASS: TestAccAWSEFSFileSystem_importBasic (66.84s)
=== RUN   TestAccAWSEFSFileSystem_basic
--- PASS: TestAccAWSEFSFileSystem_basic (164.57s)
=== RUN   TestAccAWSEFSFileSystem_pagedTags
--- PASS: TestAccAWSEFSFileSystem_pagedTags (68.46s)
=== RUN   TestAccAWSEFSFileSystem_kmsKey
--- PASS: TestAccAWSEFSFileSystem_kmsKey (123.88s)
=== RUN   TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption
--- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (73.56s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	497.346s

Thanks for the work here, nice 1st contribution! 👍 :)

@Ninir Ninir changed the title Add support for EFS encryption resource/aws_efs_file_system: Add support for encryption Aug 17, 2017
@Ninir Ninir merged commit fe3fabc into hashicorp:master Aug 17, 2017
@Ninir Ninir removed the waiting-response Maintainers are waiting on response from community or contributor. label Aug 17, 2017
@pavloos
Copy link
Contributor Author

pavloos commented Aug 18, 2017

That's great @Ninir ! Thanks for your help 👍 ;)

@shezaan
Copy link

shezaan commented Sep 8, 2017

Stupid question, which version of TF will this be added to? I am already on 0.10.4.
Documentation still doesn't reflect this if its already there.
Thanks in advance!

@Ninir
Copy link
Contributor

Ninir commented Sep 8, 2017

Hi @shezaan !

Since the Terraform split, providers (AWS, Google, Azure, Kubernetes, etc...) handle their own releases.

The one including EFS encryption will then be in the next AWS release.

I can't provide any ETA of it yet, sadly. 'will try to get back to you on that as soon as possible! 👍

nbaztec pushed a commit to nbaztec/terraform-provider-aws that referenced this pull request Sep 26, 2017
resource/aws_efs_file_system: Add support for encryption
@ghost
Copy link

ghost commented Apr 11, 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 11, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants