You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# If you with to add more than one Zesty disks (up to three are supportedvariable"disks" {
default=[
{
disk_type ="gp3"
mount_point ="/mnt"
name ="/dev/sdb"
size =15
},
{
disk_type ="gp3"
mount_point ="/mnt2"
name ="/dev/sdc"
size =20
}
]
}
data"aws_ami""this" {
most_recent=truefilter {
name="name"values=["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
owners=["099720109477"] # Canonical
}
module"zesty-disk" {
source="github.com/zesty-co/terraform-zesty-disk-config"aws_region=var.aws_regionapi_key="my-zesty-api-key"disks=var.disks
}
resource"aws_instance""this" {
ami=data.aws_ami.this.idinstance_type="t3.micro"user_data=module.zesty-disk.user_data# Note: this is *not* the root block devicedynamic"ebs_block_device" {
for_each=var.diskscontent {
device_name=ebs_block_device.value.namevolume_size=ebs_block_device.value.sizevolume_type=ebs_block_device.value.disk_typedelete_on_termination=truetags=merge(var.ebs_tags, {
ZestyDisk =true
})
}
}
# Make sure lifecycle is set to ignore ebs_block_device (and others if you have) to prevent them from being changed on future Terraform runslifecycle {
ignore_changes=[ebs_block_device]
}
}
Usage (example) Managed Deployment
module"zesty-disk" {
source="github.com/zesty-co/terraform-zesty-disk-config"aws_region=var.aws_regionapi_key="my-zesty-api-key"managed_deployment=true# Optional Parameters# EC2 Instance type defaults to t2.microinstance_type=m5.large# Create iam-role with AWS-SSMCore policy for connecting the instance using ssm instead of sshenable_ssm=true# For old fashion ssh access (make sure the default vpc sg allow inbound rule for ssh)kay_pair="my-key-pair"# The default value for disks creates one ebs_block_device# In case you want to create more then one disk# Supported volume types are gp2, and gp3# Maxdisks=[
{
disk_type ="gp3"
mount_point ="/mnt"
name ="/dev/sdb"
size =15
},
{
disk_type ="gp3"
mount_point ="/mnt2"
name ="/dev/sdc"
size =20
}
]
}