Skip to content

Resource: awsStoragegatewayStoredIscsiVolume

Manages an AWS Storage Gateway stored iSCSI volume.

\~> NOTE: The gateway must have a working storage added (e.g., via the awsStoragegatewayWorkingStorage resource) before the volume is operational to clients, however the Storage Gateway API will allow volume creation without error in that case and return volume status as workingStorageNotConfigured.

Example Usage

Create Empty Stored iSCSI Volume

/*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.storagegatewayStoredIscsiVolume.StoragegatewayStoredIscsiVolume(
  this,
  "example",
  {
    diskId: "${data.aws_storagegateway_local_disk.test.id}",
    gatewayArn: "${aws_storagegateway_cache.example.gateway_arn}",
    networkInterfaceId: "${aws_instance.example.private_ip}",
    preserveExistingData: false,
    targetName: "example",
  }
);

Create Stored iSCSI Volume From Snapshot

/*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.storagegatewayStoredIscsiVolume.StoragegatewayStoredIscsiVolume(
  this,
  "example",
  {
    diskId: "${data.aws_storagegateway_local_disk.test.id}",
    gatewayArn: "${aws_storagegateway_cache.example.gateway_arn}",
    networkInterfaceId: "${aws_instance.example.private_ip}",
    preserveExistingData: false,
    snapshotId: "${aws_ebs_snapshot.example.id}",
    targetName: "example",
  }
);

Argument Reference

The following arguments are supported:

  • gatewayArn - (Required) The Amazon Resource Name (ARN) of the gateway.
  • networkInterfaceId - (Required) The network interface of the gateway on which to expose the iSCSI target. Only IPv4 addresses are accepted.
  • targetName - (Required) The name of the iSCSI target used by initiators to connect to the target and as a suffix for the target ARN. The target name must be unique across all volumes of a gateway.
  • diskId - (Required) The unique identifier for the gateway local disk that is configured as a stored volume.
  • preserveExistingData - (Required) Specify this field as true if you want to preserve the data on the local disk. Otherwise, specifying this field as false creates an empty volume.
  • snapshotId - (Optional) The snapshot ID of the snapshot to restore as the new stored volumeE.g., snap1122Aabb.
  • kmsEncrypted - (Optional) true to use Amazon S3 server side encryption with your own AWS KMS key, or false to use a key managed by Amazon S3. Optional.
  • kmsKey - (Optional) The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server side encryption. This value can only be set when kmsEncrypted is true.
  • tags - (Optional) Key-value mapping of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - Volume Amazon Resource Name (ARN), e.g., arn:aws:storagegateway:usEast1:123456789012:gateway/sgw12345678/volume/vol12345678.
  • chapEnabled - Whether mutual CHAP is enabled for the iSCSI target.
  • id - Volume Amazon Resource Name (ARN), e.g., arn:aws:storagegateway:usEast1:123456789012:gateway/sgw12345678/volume/vol12345678.
  • lunNumber - Logical disk number.
  • networkInterfacePort - The port used to communicate with iSCSI targets.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
  • targetArn - Target Amazon Resource Name (ARN), e.g., arn:aws:storagegateway:usEast1:123456789012:gateway/sgw12345678/target/iqn199705ComAmazon:targetName.
  • volumeArn - Volume Amazon Resource Name (ARN), e.g., arn:aws:storagegateway:usEast1:123456789012:gateway/sgw12345678/volume/vol12345678.
  • volumeId - Volume ID, e.g., vol12345678.
  • volumeStatus - indicates the state of the storage volume.
  • volumeType - indicates the type of the volume.
  • volumeSizeInBytes - The size of the data stored on the volume in bytes.
  • volumeAttachmentStatus - A value that indicates whether a storage volume is attached to, detached from, or is in the process of detaching from a gateway.

Import

awsStoragegatewayStoredIscsiVolume can be imported by using the volume Amazon Resource Name (ARN), e.g.,

$ terraform import aws_storagegateway_stored_iscsi_volume.example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678