terraform.aws-baseline-infra/modules/compute/ec2
2023-06-15 15:37:13 +08:00
..
main.tf UPD: added IMDSv2 requirement 2023-06-15 15:37:13 +08:00
outputs.tf UPD: updated ec2 module to support multiple data volumes, up to 26 of them 2023-05-29 23:20:21 +08:00
README.md UPD: updated ec2 module to support multiple data volumes, up to 26 of them 2023-05-29 23:20:21 +08:00
variable.tf UPD: updated ec2 module to support multiple data volumes, up to 26 of them 2023-05-29 23:20:21 +08:00

ec2 module

This module deploys EC2 instance.

Input

Below is a sample config in the root module, which shows all of the inputs

module "deployer-ec2" {
  source = "../../../../whk1-bea-sys-ss-dev-codecommit-sharedmodules/Compute/ec2"

  ami-id           = data.aws_ami.al2-ami.id
  asso-eip         = false
  asso-public-ip   = false
  default-tags     = local.default_tags
  ebs-encrypted    = true
  instance-name    = "whk1-bea-sys-ss-${var.environment}-test"
  instance-type    = "t3.micro"
  key-name         = aws_key_pair.deployer-sshkey.key_name
  kms-key-id       = var.kms-key-arn
  root-volume-size = "15"
  security-groups  = [aws_security_group.deployer-sg.id]
  subnet-id        = var.subnet-id
  instance-profile = "example-instanec-profile"
  additional_tags = {
    "AwsBackup" : "Daily14"
    "ssm-patching" : "group1"
  }
  data-volumes = {
    volume1 = {
      size       : "10"
      type       : "gp3"
    }
  }
}

Outputs

Name Value
instance-id Instance ID
private-ip Private IP of instance

Limitation

Up to 26 data volumes can be attached to the ec2 instance. To attach even more volumes, please do it in your root module