-
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
Add deployment type to aws_fsx_lustre_file_system #13639
Add deployment type to aws_fsx_lustre_file_system #13639
Conversation
Hello, this is my first pull request into |
6926691
to
6f9f406
Compare
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, a few comments
"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, | ||
}), | ||
}, |
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.
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.
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.
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). |
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.
lets simplify this to enumerate the values in the docs here.
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.
Done, I followed the format I found from another AWS resource's doumentation.
8f50661
to
1c1a62b
Compare
@DrFaust92 requested changes implemented and unit tests pass. I have a few more minor improvements to |
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.
some more changes to tests
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"security_group_ids"}, | ||
}, | ||
{ |
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.
no need for the second test as its a property that cannot be updated
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.
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", ""), |
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.
probably need to change it to the default value here
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.
done
CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccAwsFsxLustreFileSystemDeploymentType("PERSISTENT_1"), |
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.
i think that it would be best to split this to 2 separate tests for PERSISTENT_1
and just have a plan only test for SCRATCH_1
see examples here:
https://github.com/terraform-providers/terraform-provider-aws/pull/12676/files#diff-17cef5d816ce52cd994aef2105a31a2dR117
https://github.com/terraform-providers/terraform-provider-aws/pull/12676/files#diff-17cef5d816ce52cd994aef2105a31a2dR124
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.
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
.
@mtpdt, some more changes to tests and it would be best if you could run these to save us sometime and cycles |
3bbb029
to
260518a
Compare
@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. |
getting failures for a few tests:
it seems that |
actually it seems you are missing something along the lines of the following in the read func:
|
260518a
to
ca2d1d2
Compare
@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"), |
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.
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.
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.
minor test change for import tests
resource.TestCheckResourceAttr(resourceName, "per_unit_storage_throughput", "50"), | ||
resource.TestCheckResourceAttr(resourceName, "deployment_type", fsx.LustreDeploymentTypePersistent1), | ||
), | ||
}, |
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.
can you add:
{
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"security_group_ids"},
},
to the added tests?
ca2d1d2
to
fc0e3db
Compare
thanks @mtpdt, i'll try to run these later today. fsx take so long to create and test 😢 |
sorry @mtpdt, I messed up the import test addition due to copy paste can you change it to
otherwise looks good and well run tests one more time and we are good to go |
fc0e3db
to
4ba8382
Compare
@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. |
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.
--- 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
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 |
nice, thanks! |
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! |
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! |
Community Note
Relates #12181
Release note for CHANGELOG:
Output from acceptance testing: