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 deployment type to aws_fsx_lustre_file_system #13639

Conversation

mtpdt
Copy link
Contributor

@mtpdt mtpdt commented Jun 5, 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 `deployment_type` and `per_unit_storage_throughput`

Output from acceptance testing:

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

$ 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 (615.14s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	615.195s

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

mtpdt commented Jun 5, 2020

Hello, this is my first pull request into terraform-provider-aws, so I appreciate your understanding. In your contribution guide, you mention an option to accept a "best effort" implementation of acceptance tests. Could you please try to run the acceptance tests I wrote for this feature?

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-deployment_type branch 5 times, most recently from 6926691 to 6f9f406 Compare June 5, 2020 19:56
@DrFaust92 DrFaust92 removed the needs-triage Waiting for first response or review from a maintainer. label Jul 18, 2020
@DrFaust92 DrFaust92 self-assigned this Jul 18, 2020
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.

Looks Good, a few comments

Comment on lines 111 to 131
"deployment_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
fsx.LustreDeploymentTypeScratch1,
fsx.LustreDeploymentTypeScratch2,
fsx.LustreDeploymentTypePersistent1,
}, false),
},
"per_unit_storage_throughput": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
ValidateFunc: validation.IntInSlice([]int{
50,
100,
200,
}),
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add these fields to the read function.
something along the lines of:

d.Set("deployment_type", filesystem.LustreConfiguration.DeploymentType)

you would probably need to add default value of fsx.LustreDeploymentTypeScratch1 to deployment_type as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, added a default and added the line you requested to the read function.

@@ -32,6 +32,8 @@ The following arguments are supported:
* `security_group_ids` - (Optional) A list of IDs for the security groups that apply to the specified network interfaces created for file system access. These security groups will apply to all network interfaces.
* `tags` - (Optional) A map of tags to assign to the file system.
* `weekly_maintenance_start_time` - (Optional) The preferred start time (in `d:HH:MM` format) to perform weekly maintenance, in the UTC time zone.
* `deployment_type` - (Optional) - The filesystem deployment type. For valid values, see the [AWS documentation](https://docs.aws.amazon.com/fsx/latest/APIReference/API_CreateFileSystemLustreConfiguration.html).
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets simplify this to enumerate the values in the docs 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.

Done, I followed the format I found from another AWS resource's doumentation.

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-deployment_type branch 5 times, most recently from 8f50661 to 1c1a62b Compare July 21, 2020 14:32
@mtpdt
Copy link
Contributor Author

mtpdt commented Jul 21, 2020

@DrFaust92 requested changes implemented and unit tests pass.

I have a few more minor improvements to aws_lustre_file_system that will come after this PR. Would it help speed things along if I was able to run acceptance tests myself? I'm in a bit of a constrained environment, but if it's worth it, I could put work into being able to run the acceptance tests.

@mtpdt mtpdt requested review from DrFaust92 and removed request for a team July 21, 2020 15:47
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.

some more changes to tests

ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"security_group_ids"},
},
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need for the second test as its a property that cannot be updated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -94,6 +94,8 @@ func TestAccAWSFsxLustreFileSystem_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
resource.TestMatchResourceAttr(resourceName, "vpc_id", regexp.MustCompile(`^vpc-.+`)),
resource.TestMatchResourceAttr(resourceName, "weekly_maintenance_start_time", regexp.MustCompile(`^\d:\d\d:\d\d$`)),
resource.TestCheckResourceAttr(resourceName, "deployment_type", ""),
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably need to change it to the default value 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.

done

CheckDestroy: testAccCheckFsxLustreFileSystemDestroy,
Steps: []resource.TestStep{
{
Config: testAccAwsFsxLustreFileSystemDeploymentType("PERSISTENT_1"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I've created 2 separate tests, one for PERSISTENT_1, and another for SCRATCH_2.

And I've added a plan only test for SCRATCH_1.

@DrFaust92
Copy link
Collaborator

@mtpdt, some more changes to tests and it would be best if you could run these to save us sometime and cycles

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-deployment_type branch 3 times, most recently from 3bbb029 to 260518a Compare July 21, 2020 21:21
@mtpdt
Copy link
Contributor Author

mtpdt commented Jul 21, 2020

@DrFaust92 thank you for the reviews. All current comments addressed.

I'll work on my end to run the tests myself for the subsequent PRs I send.

@DrFaust92
Copy link
Collaborator

getting failures for a few tests:

TestAccAWSFsxLustreFileSystem_PerUnitStorageThroughput
2020/07/22 13:29:52 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: Error creating FSx filesystem: IncompatibleParameterError: The storage throughput can not be specified for a lustre file system with DeploymentType=SCRATCH_2

    TestAccAWSFsxLustreFileSystem_basic: testing.go:684: Step 0 error: Check failed: Check 16/16 error: aws_fsx_lustre_file_system.test: Attribute 'per_unit_storage_throughput' not found

TestAccAWSFsxLustreFileSystem_Scratch2DeploymentType: testing.go:684: Step 0 error: errors during apply:
        
        Error: Error creating FSx filesystem: IncompatibleParameterError: The storage throughput can not be specified for a lustre file system with DeploymentType=SCRATCH_2

it seems that per_unit_storage_throughput can only be set with a persistent deployment type

@DrFaust92
Copy link
Collaborator

actually it seems you are missing something along the lines of the following in the read func:

	if filesystem.LustreConfiguration.PerUnitStorageThroughput != nil {
		d.Set("per_unit_storage_throughput", filesystem.LustreConfiguration.PerUnitStorageThroughput)
	}

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-deployment_type branch from 260518a to ca2d1d2 Compare July 22, 2020 22:15
@mtpdt
Copy link
Contributor Author

mtpdt commented Jul 22, 2020

@DrFaust92 thank you for that code snippet.

I've fixed both errors, and I've managed to get the acceptance tests running in my environment. I've updated the PR comment to include the passing acceptance test output for the new tests I've added, as well as the basic integration test for fsx lustre.

Check: resource.ComposeTestCheckFunc(
testAccCheckFsxLustreFileSystemExists(resourceName, &filesystem),
// 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"),
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 took out the separate per unit storage throughput test, and combined it into this one, since per unit storage throughput is only valid for persistent1 type lustre.

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.

minor test change for import tests

resource.TestCheckResourceAttr(resourceName, "per_unit_storage_throughput", "50"),
resource.TestCheckResourceAttr(resourceName, "deployment_type", fsx.LustreDeploymentTypePersistent1),
),
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add:

{
				ImportStateVerify:       true,
				ImportStateVerifyIgnore: []string{"security_group_ids"},
			},

to the added tests?

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-deployment_type branch from ca2d1d2 to fc0e3db Compare July 23, 2020 14:36
@DrFaust92
Copy link
Collaborator

thanks @mtpdt, i'll try to run these later today. fsx take so long to create and test 😢

@DrFaust92
Copy link
Collaborator

sorry @mtpdt, I messed up the import test addition due to copy paste

can you change it to

			{
				ResourceName:            resourceName,
				ImportState:             true,
				ImportStateVerify:       true,
				ImportStateVerifyIgnore: []string{"security_group_ids"},
			},

otherwise looks good and well run tests one more time and we are good to go

@mtpdt mtpdt force-pushed the f-aws_fsx_lustre_file_system-deployment_type branch from fc0e3db to 4ba8382 Compare July 24, 2020 14:04
@mtpdt
Copy link
Contributor Author

mtpdt commented Jul 24, 2020

@DrFaust92 no problem, thank you for running the tests for me. I've updated this PR as per your requested changes.

Note that after this one, I have two much smaller related PRs: 14314 and 14313, I have already run the acceptance tests for both of them.

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.

--- PASS: TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1 (599.31s)
--- PASS: TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2 (586.80s)
--- PASS: TestAccAWSFsxLustreFileSystem_basic (963.80s)

LGTM, ill take a look at the other PRs as well

@DrFaust92 DrFaust92 assigned breathingdust and unassigned DrFaust92 Jul 28, 2020
@breathingdust
Copy link
Member

LGTM 🚀 Thanks @DrFaust92!

Verified Acceptance Tests

make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSFsxLustreFileSystem_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSFsxLustreFileSystem_ -timeout 120m
=== RUN   TestAccAWSFsxLustreFileSystem_basic
=== PAUSE TestAccAWSFsxLustreFileSystem_basic
=== RUN   TestAccAWSFsxLustreFileSystem_disappears
=== PAUSE TestAccAWSFsxLustreFileSystem_disappears
=== RUN   TestAccAWSFsxLustreFileSystem_ExportPath
=== PAUSE TestAccAWSFsxLustreFileSystem_ExportPath
=== RUN   TestAccAWSFsxLustreFileSystem_ImportPath
=== PAUSE TestAccAWSFsxLustreFileSystem_ImportPath
=== RUN   TestAccAWSFsxLustreFileSystem_ImportedFileChunkSize
=== PAUSE TestAccAWSFsxLustreFileSystem_ImportedFileChunkSize
=== RUN   TestAccAWSFsxLustreFileSystem_SecurityGroupIds
=== PAUSE TestAccAWSFsxLustreFileSystem_SecurityGroupIds
=== RUN   TestAccAWSFsxLustreFileSystem_StorageCapacity
=== PAUSE TestAccAWSFsxLustreFileSystem_StorageCapacity
=== RUN   TestAccAWSFsxLustreFileSystem_Tags
=== PAUSE TestAccAWSFsxLustreFileSystem_Tags
=== RUN   TestAccAWSFsxLustreFileSystem_WeeklyMaintenanceStartTime
=== PAUSE TestAccAWSFsxLustreFileSystem_WeeklyMaintenanceStartTime
=== RUN   TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1
=== PAUSE TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1
=== RUN   TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2
=== PAUSE TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2
=== CONT  TestAccAWSFsxLustreFileSystem_basic
=== CONT  TestAccAWSFsxLustreFileSystem_StorageCapacity
=== CONT  TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1
=== CONT  TestAccAWSFsxLustreFileSystem_WeeklyMaintenanceStartTime
=== CONT  TestAccAWSFsxLustreFileSystem_Tags
=== CONT  TestAccAWSFsxLustreFileSystem_ExportPath
=== CONT  TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2
=== CONT  TestAccAWSFsxLustreFileSystem_ImportPath
=== CONT  TestAccAWSFsxLustreFileSystem_SecurityGroupIds
=== CONT  TestAccAWSFsxLustreFileSystem_ImportedFileChunkSize
=== CONT  TestAccAWSFsxLustreFileSystem_disappears
--- PASS: TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1 (426.79s)
--- PASS: TestAccAWSFsxLustreFileSystem_WeeklyMaintenanceStartTime (440.55s)
--- PASS: TestAccAWSFsxLustreFileSystem_basic (486.00s)
--- PASS: TestAccAWSFsxLustreFileSystem_Tags (541.28s)
--- PASS: TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2 (548.79s)
--- PASS: TestAccAWSFsxLustreFileSystem_disappears (559.20s)
--- PASS: TestAccAWSFsxLustreFileSystem_StorageCapacity (996.81s)
--- PASS: TestAccAWSFsxLustreFileSystem_SecurityGroupIds (1010.93s)
--- PASS: TestAccAWSFsxLustreFileSystem_ImportedFileChunkSize (1214.90s)
--- PASS: TestAccAWSFsxLustreFileSystem_ExportPath (1457.39s)
--- PASS: TestAccAWSFsxLustreFileSystem_ImportPath (1476.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	1478.540s

@breathingdust breathingdust added this to the v3.0.0 milestone Jul 28, 2020
@breathingdust breathingdust merged commit 47d4803 into hashicorp:master Jul 28, 2020
@mtpdt
Copy link
Contributor Author

mtpdt commented Jul 29, 2020

nice, thanks!

@mtpdt mtpdt deleted the f-aws_fsx_lustre_file_system-deployment_type branch July 29, 2020 14:19
@ghost
Copy link

ghost commented Jul 31, 2020

This has been released in version 3.0.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 Aug 28, 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 Aug 28, 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. service/fsx Issues and PRs that pertain to the fsx 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.

3 participants