Module: ec2-admin-server
Terraform Module for providing a server capable of running admin tasks. Use terraform-aws-ec2-admin-server
to create and manage an admin instance.
Usage
Note: add ${var.ssh_key_pair}
private key to the ssh agent
.
Include this repository as a module in your existing terraform code:
module "admin_tier" {
source = "git::https://github.com/cloudposse/terraform-aws-ec2-admin-server.git?ref=master"
ssh_key_pair = "${var.ssh_key_pair}"
github_api_token = "${var.github_api_token}"
github_organization = "${var.github_organization}"
github_team = "${var.github_team}"
instance_type = "${var.instance_type}"
vpc_id = "${var.vpc_id}"
name = "admin"
namespace = "${var.namespace}"
stage = "${var.stage}"
subnets = ["${var.subnets}"]
zone_id = "${module.terraform-aws-route53-cluster-zone.zone_id}"
security_groups = ["${var.security_groups}"]
allow_cidr_blocks = ["${var.allow_cidr_blocks}"]
}
Module terraform-aws-route53-cluster-zone
Module terraform-aws-ec2-admin-server
requires another module to be used additionally - terraform-aws-route53-cluster-zone
.
terraform-aws-ec2-admin-server
uses terraform-aws-route53-cluster-hostname
to create a DNS record for created host. terraform-aws-route53-cluster-hostname
module needs zone_id
parameter as an input, and this parameter actually is an output from terraform-aws-route53-cluster-zone
.
That is why terraform-aws-route53-cluster-zone
should be implemented in root
TF manifest when we need terraform-aws-ec2-admin-server
.
This module depends on the next modules:
- terraform-null-label
- terraform-aws-ubuntu-github-authorized-keys-user-data
- terraform-aws-route53-cluster-hostname
- terraform-aws-route53-cluster-zone (not directly, but
terraform-aws-route53-cluster-hostname
need childzone_id
)
It is necessary to run terraform get
to download those modules.
Now reference the label when creating an instance (for example):
resource "aws_ami_from_instance" "example" {
name = "terraform-example"
source_instance_id = "${module.admin_tier.id}"
}