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 mount_name to aws_fsx_lustre_file_system #14313

Conversation

mtpdt
Copy link
Contributor

@mtpdt mtpdt commented Jul 23, 2020

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

Relates #12181

Release note for CHANGELOG:

resource/aws_fsx_lustre_file_system: Add `mount_name`

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSFsxLustreFileSystem_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSFsxLustreFileSystem_basic -timeout 120m
=== RUN   TestAccAWSFsxLustreFileSystem_basic
=== PAUSE TestAccAWSFsxLustreFileSystem_basic
=== CONT  TestAccAWSFsxLustreFileSystem_basic
--- PASS: TestAccAWSFsxLustreFileSystem_basic (500.30s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	500.359s

@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/fsx Issues and PRs that pertain to the fsx service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. documentation Introduces or discusses updates to documentation. needs-triage Waiting for first response or review from a maintainer. labels Jul 23, 2020
@mtpdt
Copy link
Contributor Author

mtpdt commented Jul 23, 2020

The mount_name is required for automation with the PERSISTENT1 FSX lustre deployment type (which I am adding support for in #13639 . For SCRATCH1, it is always fsx, but for PERSISTENT1, it is autogenerated by AWS, so retrieving it dynamically via terraform is important.

@DrFaust92 DrFaust92 self-requested a review July 23, 2020 07:27
@DrFaust92 DrFaust92 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 Jul 23, 2020
@mtpdt mtpdt marked this pull request as ready for review July 23, 2020 14:39
@mtpdt mtpdt requested a review from a team July 23, 2020 14:39
@DrFaust92 DrFaust92 self-assigned this Jul 24, 2020
@DrFaust92
Copy link
Collaborator

@mtpdt, looks good, more tests will need to be added after #13639 is merged

@DrFaust92
Copy link
Collaborator

@mtpdt can you rebase this branch and add the mentioned tests?

@mtpdt
Copy link
Contributor Author

mtpdt commented Jul 31, 2020

Okay, will do

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-mount_name branch 2 times, most recently from ef6ee58 to 73a544e Compare August 1, 2020 17:39
@@ -403,6 +404,8 @@ func TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1(t *testing.T) {
// per_unit_storage_throughput is only available with deployment_type=PERSISTENT_1, so we test both here.
resource.TestCheckResourceAttr(resourceName, "per_unit_storage_throughput", "50"),
resource.TestCheckResourceAttr(resourceName, "deployment_type", fsx.LustreDeploymentTypePersistent1),
resource.TestMatchResourceAttr(resourceName, "mount_name", regexp.MustCompile(`^[a-z0-9]+fbmv$`)),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The mount names always have the suffix fbmv, although that isn't documented publicly by AWS, so I don't know if we can consider that stable.

The other options are to just check that it's a lowercase alphanumeric string, or to check that it's not fsx which is the default mount name for SCRATCH_1 deployment types.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i ran the tests and the mount name didnt seem to be ending with fbmv.

    testing.go:684: Step 0 error: Check failed: Check 4/4 error: aws_fsx_lustre_file_system.test: Attribute 'mount_name' didn't match "^[a-z0-9]+fbmv$", got "mlvg5bmv"

it doesn't seem to have any logic, according to docs:

For the SCRATCH_1 deployment type, this value is always "fsx". For SCRATCH_2 and PERSISTENT_1 deployment types, this value is a string that is unique  within an AWS Region.

Lets change this to be not equal fsx as you proposed. i dont see any other way except just checking the value is set with no other validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DrFaust92 I implemented it as "just checking the value is set with no other validation".

I took a peek around the repository, and found the resource.TestCheckResourceAttrSet used in a bunch of places, which seems expressly for this purpose (a resource that we don't know the value ahead of time). I did not find any resource.TestCheckResourceAttrDoesNotMatch method in the resource go library.

So I figured it would be better to follow the existing convention, and not duplicate complex resource-retrieval logic from github.com/hashicorp/terraform-plugin-sdk/helper/resource. We're not doing any transformation on the mount_name retrieved from AWS, just passing it through, so ultimately I don't think an integration test that checks it's not equal to fsx would do much.

Let me know what you think. I can put together a "not fsx" integration test if you feel strongly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that just checking that the attribute is set is good enough

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-mount_name branch from 73a544e to 255b1e3 Compare August 1, 2020 17:52
@DrFaust92 DrFaust92 removed the request for review from a team August 1, 2020 18:41
@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-mount_name branch from 255b1e3 to 6dcf684 Compare August 2, 2020 21:58
Copy link
Collaborator

@DrFaust92 DrFaust92 left a comment

Choose a reason for hiding this comment

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

LGTM

--- PASS: TestAccAWSFsxLustreFileSystem_basic (689.59s)
--- PASS: TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1 (550.02s)

@mtpdt
Copy link
Contributor Author

mtpdt commented Aug 17, 2020

@DrFaust92 any next steps needed on my part, or can you merge this in?

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM.

Verified acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSFsxLustreFileSystem_basic\|TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1\|TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSFsxLustreFileSystem_basic\|TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1\|TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2 -timeout 120m
=== RUN   TestAccAWSFsxLustreFileSystem_basic
=== PAUSE TestAccAWSFsxLustreFileSystem_basic
=== RUN   TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1
=== PAUSE TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1
=== RUN   TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2
=== PAUSE TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2
=== CONT  TestAccAWSFsxLustreFileSystem_basic
=== CONT  TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2
=== CONT  TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1
--- PASS: TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1 (472.54s)
--- PASS: TestAccAWSFsxLustreFileSystem_basic (494.94s)
--- PASS: TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2 (597.53s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	597.591s

@breathingdust
Copy link
Member

Hi @mtpdt 👋
Would you be able to resolve these conflicts? Then we can get this merged!

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-mount_name branch from 6dcf684 to 4a9a886 Compare September 22, 2020 02:42
@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-mount_name branch from 4a9a886 to 0d36e0d Compare September 23, 2020 02:46
@mtpdt
Copy link
Contributor Author

mtpdt commented Sep 23, 2020

@breathingdust merge conflicts resolved.

@breathingdust
Copy link
Member

LGTM! 🚀 Thanks @mtpdt

Verified Acceptance Tests in Commerical (us-west-2)

make testacc TESTARGS='-run=TestAccAWSFsxLustreFileSystem_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSFsxLustreFileSystem_basic -timeout 120m
=== RUN   TestAccAWSFsxLustreFileSystem_basic
=== PAUSE TestAccAWSFsxLustreFileSystem_basic
=== CONT  TestAccAWSFsxLustreFileSystem_basic
--- PASS: TestAccAWSFsxLustreFileSystem_basic (570.35s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	572.771s

@breathingdust breathingdust added this to the v3.8.0 milestone Sep 23, 2020
@breathingdust breathingdust merged commit 581f8c9 into hashicorp:master Sep 23, 2020
breathingdust added a commit that referenced this pull request Sep 23, 2020
@ghost
Copy link

ghost commented Sep 24, 2020

This has been released in version 3.8.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 Oct 23, 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 as resolved and limited conversation to collaborators Oct 23, 2020
@mtpdt mtpdt deleted the f-aws_fsx_lustre_file_system-mount_name branch January 4, 2021 19:03
@DrFaust92 DrFaust92 removed their assignment Jun 6, 2022
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/fsx Issues and PRs that pertain to the fsx service. size/XS 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.

None yet

4 participants