Skip to content

Resource: awsStoragegatewayCachedIscsiVolume

Manages an AWS Storage Gateway cached iSCSI volume.

\~> NOTE: The gateway must have cache added (e.g., via the awsStoragegatewayCache resource) before creating volumes otherwise the Storage Gateway API will return an error.

\~> NOTE: The gateway must have an upload buffer added (e.g., via the awsStoragegatewayUploadBuffer 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 uploadBufferNotConfigured.

Example Usage

\~> NOTE: These examples are referencing the awsStoragegatewayCache resource gatewayArn attribute to ensure Terraform properly adds cache before creating the volume. If you are not using this method, you may need to declare an expicit dependency (e.g., via dependsOn = [awsStoragegatewayCacheExample]) to ensure proper ordering.

Create Empty Cached 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.storagegatewayCachedIscsiVolume.StoragegatewayCachedIscsiVolume(
  this,
  "example",
  {
    gatewayArn: "${aws_storagegateway_cache.example.gateway_arn}",
    networkInterfaceId: "${aws_instance.example.private_ip}",
    targetName: "example",
    volumeSizeInBytes: 5368709120,
  }
);

Create Cached 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.storagegatewayCachedIscsiVolume.StoragegatewayCachedIscsiVolume(
  this,
  "example",
  {
    gatewayArn: "${aws_storagegateway_cache.example.gateway_arn}",
    networkInterfaceId: "${aws_instance.example.private_ip}",
    snapshotId: "${aws_ebs_snapshot.example.id}",
    targetName: "example",
    volumeSizeInBytes:
      "${aws_ebs_snapshot.example.volume_size * 1024 * 1024 * 1024}",
  }
);

Create Cached iSCSI Volume From Source 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.storagegatewayCachedIscsiVolume.StoragegatewayCachedIscsiVolume(
  this,
  "example",
  {
    gatewayArn: "${aws_storagegateway_cache.example.gateway_arn}",
    networkInterfaceId: "${aws_instance.example.private_ip}",
    sourceVolumeArn: "${aws_storagegateway_cached_iscsi_volume.existing.arn}",
    targetName: "example",
    volumeSizeInBytes:
      "${aws_storagegateway_cached_iscsi_volume.existing.volume_size_in_bytes}",
  }
);

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.
  • volumeSizeInBytes - (Required) The size of the volume in bytes.
  • snapshotId - (Optional) The snapshot ID of the snapshot to restore as the new cached volumeE.g., snap1122Aabb.
  • sourceVolumeArn - (Optional) The ARN for an existing volume. Specifying this ARN makes the new volume into an exact copy of the specified existing volume's latest recovery point. The volumeSizeInBytes value for this new volume must be equal to or larger than the size of the existing volume, in bytes.
  • kmsEncrypted - (Optional) Set to true to use Amazon S3 server side encryption with your own AWS KMS key, or false to use a key managed by Amazon S3.
  • kmsKey - (Optional) The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server side encryption. Is required when kmsEncrypted is set.
  • tags - (Optional) Key-value map 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.

Import

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

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