Created
November 6, 2024 13:21
-
-
Save arianvp/14dd40742c24894bb312ac3f5b90b433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_s3_bucket_item" "this" { | |
bucket = "images" | |
key = var.image_name | |
source = var.image_path | |
} | |
resource "aws_ebs_snapshort_import" "this" { | |
disk_container { | |
type = "VHD" | |
user_bucket = aws_s3_bucket_item.this.bucket | |
s3_key = aws_s3_bucket_item.this.key | |
} | |
} | |
resource "aws_ami" "this" { | |
name = var.image_name | |
virtualization_type = "hvm" | |
root_device_name = "/dev/xvda" | |
imds_support = "v2.0" | |
architecture = "x86_64" | |
ebs_block_device { | |
device_name = "/dev/xvda" | |
snapshot_id = aws_ebs_snapshort_import.this.snapshot_id | |
} | |
} | |
resource "aws_instance" "this" { | |
ami = aws_ami.this.id | |
instance_type = "t4g.small" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment