# resource "aws_instance" "Test" { # ami = data.aws_ami.this.id # instance_type = "t4g.large" # # tags = { # Name : "TestInstance001" # } # } module "TestInstance" { source = "terraform-aws-modules/ec2-instance/aws" version = "6.2.0" 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" { most_recent = true name_regex = "^al2023-ami-2023.*-kernel-6.1-arm64" owners = ["amazon"] } resource "random_pet" "this" { length = 1 } module "KmsKeys" { source = "../../../modules/security_identity_compliance/CustomerManagedKmsKeys" create-allpurpose-key = true create-backup-key = false create-database-key = false create-eksebs-key = false create-log-key = false create-notify-key = false create-secret-key = false create-storage-key = false deletion_window_in_days = 7 }