Resource: aws_storagegateway_gateway

Manages an AWS Storage Gateway file, tape, or volume gateway in the provider region.

Example Usage

Local Cache

resource "aws_volume_attachment" "test" {
  device_name = "/dev/xvdb"
  volume_id   = aws_ebs_volume.test.id
  instance_id = aws_instance.test.id
}

data "aws_storagegateway_local_disk" "test" {
  disk_node   = data.aws_volume_attachment.test.device_name
  gateway_arn = aws_storagegateway_gateway.test.arn
}

resource "aws_storagegateway_cache" "test" {
  disk_id     = data.aws_storagegateway_local_disk.test.disk_id
  gateway_arn = aws_storagegateway_gateway.test.arn
}

FSx File Gateway

resource "aws_storagegateway_gateway" "example" {
  gateway_ip_address = "1.2.3.4"
  gateway_name       = "example"
  gateway_timezone   = "GMT"
  gateway_type       = "FILE_FSX_SMB"
  smb_active_directory_settings {
    domain_name = "corp.example.com"
    password    = "avoid-plaintext-passwords"
    username    = "Admin"
  }
}

S3 File Gateway

resource "aws_storagegateway_gateway" "example" {
  gateway_ip_address = "1.2.3.4"
  gateway_name       = "example"
  gateway_timezone   = "GMT"
  gateway_type       = "FILE_S3"
}

Tape Gateway

resource "aws_storagegateway_gateway" "example" {
  gateway_ip_address  = "1.2.3.4"
  gateway_name        = "example"
  gateway_timezone    = "GMT"
  gateway_type        = "VTL"
  medium_changer_type = "AWS-Gateway-VTL"
  tape_drive_type     = "IBM-ULT3580-TD5"
}

Volume Gateway (Cached)

resource "aws_storagegateway_gateway" "example" {
  gateway_ip_address = "1.2.3.4"
  gateway_name       = "example"
  gateway_timezone   = "GMT"
  gateway_type       = "CACHED"
}

Volume Gateway (Stored)

resource "aws_storagegateway_gateway" "example" {
  gateway_ip_address = "1.2.3.4"
  gateway_name       = "example"
  gateway_timezone   = "GMT"
  gateway_type       = "STORED"
}

Argument Reference

This argument supports the following arguments:

maintenance_start_time

smb_active_directory_settings

Information to join the gateway to an Active Directory domain for Server Message Block (SMB) file shares.

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Gateway Network Interface

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import aws_storagegateway_gateway using the gateway Amazon Resource Name (ARN). For example:

import {
  to = aws_storagegateway_gateway.example
  id = "arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678"
}

Using terraform import, import aws_storagegateway_gateway using the gateway Amazon Resource Name (ARN). For example:

% terraform import aws_storagegateway_gateway.example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678

Certain resource arguments, like gateway_ip_address do not have a Storage Gateway API method for reading the information after creation, either omit the argument from the Terraform configuration or use ignore_changes to hide the difference. For example:

resource "aws_storagegateway_gateway" "example" {
  # ... other configuration ...

  gateway_ip_address = aws_instance.sgw.private_ip
  # There is no Storage Gateway API for reading gateway_ip_address
  lifecycle {
    ignore_changes = ["gateway_ip_address"]
  }
}