terraform.aws-baseline-infra/modules/compute/ec2/README.md

1.2 KiB

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