Resource: awsStoragegatewayFileSystemAssociation
Associate an Amazon FSx file system with the FSx File Gateway. After the association process is complete, the file shares on the Amazon FSx file system are available for access through the gateway. This operation only supports the FSx File Gateway type.
FSx File Gateway requirements.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.storagegatewayFileSystemAssociation.StoragegatewayFileSystemAssociation(
this,
"example",
{
auditDestinationArn: "${aws_s3_bucket.example.arn}",
gatewayArn: "${aws_storagegateway_gateway.example.arn}",
locationArn: "${aws_fsx_windows_file_system.example.arn}",
password: "avoid-plaintext-passwords",
username: "Admin",
}
);
Required Services Example
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsFsxWindowsFileSystemTest =
new aws.fsxWindowsFileSystem.FsxWindowsFileSystem(this, "test", {
activeDirectoryId: "${aws_directory_service_directory.test.id}",
securityGroupIds: ["${aws_security_group.test.id}"],
skipFinalBackup: true,
storageCapacity: 32,
subnetIds: ["${aws_subnet.test[0].id}"],
throughputCapacity: 8,
});
const dataAwsSsmParameterAwsServiceStoragegatewayAmiFileS3Latest =
new aws.dataAwsSsmParameter.DataAwsSsmParameter(
this,
"aws_service_storagegateway_ami_FILE_S3_latest",
{
name: "/aws/service/storagegateway/ami/FILE_S3/latest",
}
);
const awsInstanceTest = new aws.instance.Instance(this, "test_2", {
ami: dataAwsSsmParameterAwsServiceStoragegatewayAmiFileS3Latest.value,
associatePublicIpAddress: true,
depends_on: ["${aws_route.test}", "${aws_vpc_dhcp_options_association.test}"],
instanceType:
"${data.aws_ec2_instance_type_offering.available.instance_type}",
subnetId: "${aws_subnet.test[0].id}",
vpcSecurityGroupIds: ["${aws_security_group.test.id}"],
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsInstanceTest.overrideLogicalId("test");
const awsStoragegatewayGatewayTest =
new aws.storagegatewayGateway.StoragegatewayGateway(this, "test_3", {
gatewayIpAddress: awsInstanceTest.publicIp,
gatewayName: "test-sgw",
gatewayTimezone: "GMT",
gatewayType: "FILE_FSX_SMB",
smbActiveDirectorySettings: {
domainName: "${aws_directory_service_directory.test.name}",
password: "${aws_directory_service_directory.test.password}",
username: "Admin",
},
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsStoragegatewayGatewayTest.overrideLogicalId("test");
new aws.storagegatewayFileSystemAssociation.StoragegatewayFileSystemAssociation(
this,
"fsx",
{
auditDestinationArn: "${aws_cloudwatch_log_group.test.arn}",
cacheAttributes: {
cacheStaleTimeoutInSeconds: 400,
},
gatewayArn: awsStoragegatewayGatewayTest.arn,
locationArn: awsFsxWindowsFileSystemTest.arn,
password: "${aws_directory_service_directory.test.password}",
username: "Admin",
}
);
Argument Reference
The following arguments are supported:
gatewayArn
- (Required) The Amazon Resource Name (ARN) of the gateway.locationArn
- (Required) The Amazon Resource Name (ARN) of the Amazon FSx file system to associate with the FSx File Gateway.username
- (Required) The user name of the user credential that has permission to access the root share of the Amazon FSx file system. The user account must belong to the Amazon FSx delegated admin user group.password
- (Required, sensitive) The password of the user credential.auditDestinationArn
- (Optional) The Amazon Resource Name (ARN) of the storage used for the audit logs.cacheAttributes
- (Optional) Refresh cache information. see Cache Attributes for more details.tags
- (Optional) Key-value map of resource tags. If configured with a providerdefaultTags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
cacheAttributes
cacheStaleTimeoutInSeconds
- (Optional) Refreshes a file share's cache by using Time To Live (TTL). TTL is the length of time since the last refresh after which access to the directory would cause the file gateway to first refresh that directory's contents from the Amazon S3 bucket. Valid Values:0
or300
to2592000
seconds (5 minutes to 30 days). Defaults to0
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- Amazon Resource Name (ARN) of the FSx file system associationarn
- Amazon Resource Name (ARN) of the newly created file system association.tagsAll
- A map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.
Import
awsStoragegatewayFileSystemAssociation
can be imported by using the FSx file system association Amazon Resource Name (ARN), e.g.,