aws.ec2-volume resource¶
Description¶
Volume is an EBS volume: a block storage device created in one Availability Zone from a size, a snapshot, or both. The zone, encryption, KMS key, Multi-Attach flag, Outpost, source snapshot, and initialization rate are fixed when the volume is created, so a change to any of them replaces the volume; the size, IOPS, throughput, and volume type are reconciled in place by ModifyVolume. CreateVolume accepts every create-time field in one call; the only follow-on work is the settling wait and, at delete time, an optional final snapshot. A nil optional field is never sent: the server applies its own default and fills the computed outputs.
Source: internal/service/ec2/volume_rsrc.go:31
Example usage:
imports: {
aws: 'github.com/cloudboss/unobin-library-aws'
}
resources: {
example: aws.ec2-volume {
# Set input fields here.
}
}
Inputs¶
availability-zone
string
encrypted
optional(boolean)
iops
optional(integer)
kms-key-id
optional(string)
multi-attach-enabled
optional(boolean)
outpost-arn
optional(string)
size
optional(integer)
snapshot-id
optional(string)
throughput
optional(integer)
type
optional(string)
volume-initialization-rate
optional(integer)
tags
map(string)
final-snapshot
optional(boolean)
FinalSnapshot is read only at delete time. When true, Delete first takes a snapshot of the volume and waits for it to complete before removing the volume. It backs no CreateVolume field and is never reconciled after create.
Input Constraints¶
Field combinations
At least one of size or snapshot-id.
Type rules
type must be standard, gp2, gp3, io1, io2, sc1, or st1.
Rule logic
- When
input.type != null- Require
input.type == 'standard'
|| input.type == 'gp2'
|| input.type == 'gp3'
|| input.type == 'io1'
|| input.type == 'io2'
|| input.type == 'sc1'
|| input.type == 'st1'
iops is required when type is io1.
Rule logic
- When
input.type == 'io1'- Require
input.iops != null
iops is required when type is io2.
Rule logic
- When
input.type == 'io2'- Require
input.iops != null
Iops rules
iops is valid only for gp3, io1, or io2 volume types.
Rule logic
- When
input.iops != null- Require
input.type == 'gp3'
|| input.type == 'io1'
|| input.type == 'io2'
Throughput rules
throughput is valid only for gp3 volumes and must be 125 to 2000.
Rule logic
- When
input.throughput != null- Require
input.type == 'gp3'
&& (input.throughput == null || input.throughput >= 125)
&& (input.throughput == null || input.throughput <= 2000)
Multi attach enabled rules
multi-attach-enabled is valid only for io1 or io2 volume types.
Rule logic
- When
input.multi-attach-enabled == true- Require
input.type == 'io1'
|| input.type == 'io2'
Volume initialization rate rules
volume-initialization-rate requires snapshot-id and must be 100 to 300.
Rule logic
- When
input.volume-initialization-rate != null- Require
input.snapshot-id != null
&& (input.volume-initialization-rate == null || input.volume-initialization-rate >= 100)
&& (input.volume-initialization-rate == null || input.volume-initialization-rate <= 300)
Outputs¶
volume-id
string
create-time
string
size
integer
type
string
iops
integer
throughput
integer
encrypted
boolean
kms-key-id
string