52 lines
1.3 KiB
Terraform
52 lines
1.3 KiB
Terraform
# resource "aws_instance" "Test" {
|
|
# ami = data.aws_ami.this.id
|
|
# instance_type = "t4g.large"
|
|
#
|
|
# tags = {
|
|
# Name : "TestInstance001"
|
|
# }
|
|
# }
|
|
|
|
module "TestInstance" {
|
|
source = "../../../modules/compute/ec2"
|
|
|
|
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
|
|
}
|
|
|
|
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
|
|
} |