From 0d36e0da0bccff835caf680eb9e39afd1f00e1b9 Mon Sep 17 00:00:00 2001 From: Matthew Tse <66440247+mtpdt@users.noreply.github.com> Date: Tue, 21 Jul 2020 10:42:21 -0400 Subject: [PATCH] Add mount_name to aws_fsx_lustre_file_system --- aws/resource_aws_fsx_lustre_file_system.go | 5 +++++ aws/resource_aws_fsx_lustre_file_system_test.go | 5 +++++ website/docs/r/fsx_lustre_file_system.html.markdown | 1 + 3 files changed, 11 insertions(+) diff --git a/aws/resource_aws_fsx_lustre_file_system.go b/aws/resource_aws_fsx_lustre_file_system.go index 05ce2e7f4e5..4f76d8852e5 100644 --- a/aws/resource_aws_fsx_lustre_file_system.go +++ b/aws/resource_aws_fsx_lustre_file_system.go @@ -64,6 +64,10 @@ func resourceAwsFsxLustreFileSystem() *schema.Resource { ForceNew: true, ValidateFunc: validation.IntBetween(1, 512000), }, + "mount_name": { + Type: schema.TypeString, + Computed: true, + }, "network_interface_ids": { // As explained in https://docs.aws.amazon.com/fsx/latest/LustreGuide/mounting-on-premises.html, the first // network_interface_id is the primary one, so ordering matters. Use TypeList instead of TypeSet to preserve it. @@ -304,6 +308,7 @@ func resourceAwsFsxLustreFileSystemRead(d *schema.ResourceData, meta interface{} if lustreConfig.PerUnitStorageThroughput != nil { d.Set("per_unit_storage_throughput", lustreConfig.PerUnitStorageThroughput) } + d.Set("mount_name", filesystem.LustreConfiguration.MountName) if filesystem.KmsKeyId != nil { d.Set("kms_key_id", filesystem.KmsKeyId) diff --git a/aws/resource_aws_fsx_lustre_file_system_test.go b/aws/resource_aws_fsx_lustre_file_system_test.go index 6f862028f75..5cd2123475d 100644 --- a/aws/resource_aws_fsx_lustre_file_system_test.go +++ b/aws/resource_aws_fsx_lustre_file_system_test.go @@ -86,6 +86,7 @@ func TestAccAWSFsxLustreFileSystem_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "export_path", ""), resource.TestCheckResourceAttr(resourceName, "import_path", ""), resource.TestCheckResourceAttr(resourceName, "imported_file_chunk_size", "0"), + resource.TestCheckResourceAttr(resourceName, "mount_name", "fsx"), resource.TestCheckResourceAttr(resourceName, "network_interface_ids.#", "2"), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "storage_capacity", "1200"), @@ -447,6 +448,8 @@ func TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "deployment_type", fsx.LustreDeploymentTypePersistent1), resource.TestCheckResourceAttr(resourceName, "automatic_backup_retention_days", "0"), testAccMatchResourceAttrRegionalARN(resourceName, "kms_key_id", "kms", regexp.MustCompile(`key/.+`)), + // We don't know the randomly generated mount_name ahead of time like for SCRATCH_1 deployment types. + resource.TestCheckResourceAttrSet(resourceName, "mount_name"), ), }, { @@ -511,6 +514,8 @@ func TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckFsxLustreFileSystemExists(resourceName, &filesystem), resource.TestCheckResourceAttr(resourceName, "deployment_type", fsx.LustreDeploymentTypeScratch2), + // We don't know the randomly generated mount_name ahead of time like for SCRATCH_1 deployment types. + resource.TestCheckResourceAttrSet(resourceName, "mount_name"), ), }, { diff --git a/website/docs/r/fsx_lustre_file_system.html.markdown b/website/docs/r/fsx_lustre_file_system.html.markdown index 5044a62b0c6..abae93efbdb 100644 --- a/website/docs/r/fsx_lustre_file_system.html.markdown +++ b/website/docs/r/fsx_lustre_file_system.html.markdown @@ -45,6 +45,7 @@ In addition to all arguments above, the following attributes are exported: * `dns_name` - DNS name for the file system, e.g. `fs-12345678.fsx.us-west-2.amazonaws.com` * `id` - Identifier of the file system, e.g. `fs-12345678` * `network_interface_ids` - Set of Elastic Network Interface identifiers from which the file system is accessible. As explained in the [documentation](https://docs.aws.amazon.com/fsx/latest/LustreGuide/mounting-on-premises.html), the first network interface returned is the primary network interface. +* `mount_name` - The value to be used when mounting the filesystem. * `owner_id` - AWS account identifier that created the file system. * `vpc_id` - Identifier of the Virtual Private Cloud for the file system.