1
0

feat: changed ec2 module and updated readme

This commit is contained in:
xpk
2026-02-19 14:18:01 +08:00
parent 4b4ee898df
commit fd8d141662
3 changed files with 29 additions and 18 deletions
+20 -16
View File
@@ -8,23 +8,27 @@
# }
module "TestInstance" {
source = "../../../modules/compute/ec2"
source = "terraform-aws-modules/ec2-instance/aws"
version = "6.2.0"
additional-tags = {}
ami-id = data.aws_ami.this.id
asso-eip = false
asso-public-ip = false
data-volumes = {}
instance-name = "TestInstance001"
instance-type = "t4g.large"
kms-key-id = module.KmsKeys.cmks["allpurpose"].arn
root-volume-size = 20
security-groups = []
subnet-id = data.terraform_remote_state.vpc.outputs.private_subnets[0]
user-data = <<EOF
#!/bin/bash
dnf -y install git
EOF
ami = data.aws_ami.this.id
associate_public_ip_address = false
create_eip = false
name = "TestInstance001"
instance_type = "t4g.large"
subnet_id = data.terraform_remote_state.vpc.outputs.private_subnets[0]
create_security_group = false
root_block_device = {
device_name = "/dev/xvda"
type = "gp3"
size = 20
delete_on_termination = true
kms_key_id = module.KmsKeys.cmks["allpurpose"].arn
}
metadata_options = {
http_put_response_hop_limit = 2
http_tokens = "required"
}
}
data "aws_ami" "this" {
+4 -1
View File
@@ -1,3 +1,6 @@
output "instance_info" {
value = module.TestInstance.ec2-id-ip
value = {
id = module.TestInstance.id,
private_ip = module.TestInstance.private_ip
}
}