diff options
author | Kelley Spoon <kelley.spoon@linaro.org> | 2022-11-30 23:49:50 -0600 |
---|---|---|
committer | Kelley Spoon <kelley.spoon@linaro.org> | 2022-12-01 10:15:38 -0600 |
commit | 75ff2b6550f62bd37ca67ef99966c66273dd7362 (patch) | |
tree | 2d7fc5dd0a3a957e6044502208cb9a50e32f9577 | |
parent | 2d9ac7b790ea02074b46834c806b9fb1f3d8fb15 (diff) |
deployments: add server for deployments glr
This change adds in the code to deploy a small
server in order to host a gitlab-runner instance
for LinaroLtd that is intended to support CD and
scheduled jobs used by STG.
Signed-off-by: Kelley Spoon <kelley.spoon@linaro.org>
Change-Id: I91eb6fa5450488321d28f2761affca6062824e4b
l--------- | deployments/.role.conf | 1 | ||||
-rw-r--r-- | deployments/deployments.tf | 64 | ||||
-rw-r--r-- | deployments/deployments.tfvars | 3 |
3 files changed, 68 insertions, 0 deletions
diff --git a/deployments/.role.conf b/deployments/.role.conf new file mode 120000 index 0000000..7ba25d6 --- /dev/null +++ b/deployments/.role.conf @@ -0,0 +1 @@ +../.role.conf
\ No newline at end of file diff --git a/deployments/deployments.tf b/deployments/deployments.tf new file mode 100644 index 0000000..c0372c0 --- /dev/null +++ b/deployments/deployments.tf @@ -0,0 +1,64 @@ +variable "ami_key_pair_name" {} +variable "route53_zone_id" { type = "string" } +variable "route53_zone_name" { type = "string" } + +provider "aws" { + region = "us-east-1" + skip_region_validation = true +} + +terraform { + backend "s3" { + bucket = "linaro-terraform-state" + key = "lss/production/deployments.tfstate" + region = "us-east-1" + skip_region_validation = true + } +} + +data "terraform_remote_state" "vpc" { + backend = "s3" + config{ + bucket = "linaro-terraform-state" + key = "lss/production/ctt-vpc-us-east-1.tfstate" + region = "us-east-1" + skip_region_validation = true + } +} + + +data "aws_ami" "ubuntu" { + most_recent = true + + filter { + name = "name" + values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"] + } + + owners = ["099720109477"] # Official Canonical ID +} + +resource "aws_instance" "deployments" { + ami = "${data.aws_ami.ubuntu.id}" + instance_type = "t3.small" + subnet_id = "subnet-018f93a3c290edec1" + vpc_security_group_ids = [ "sg-0c1d4267ed40ae539", + ] + key_name = "${var.ami_key_pair_name}" + tags = { + Name = "deployments" + } +} + +resource "aws_eip" "deployments-ip" { + instance = "${aws_instance.deployments.id}" + vpc = true +} + +resource "aws_route53_record" "deployments-dns" { + zone_id = "${var.route53_zone_id}" + name = "deployments" + type = "A" + ttl = "60" + records = ["${aws_eip.deployments-ip.public_ip}"] +} diff --git a/deployments/deployments.tfvars b/deployments/deployments.tfvars new file mode 100644 index 0000000..7e1d358 --- /dev/null +++ b/deployments/deployments.tfvars @@ -0,0 +1,3 @@ +route53_zone_id = "Z27NRA2FV79C84" +route53_zone_name = "ctt.linaro.org" +ami_key_pair_name = "systems-bot-ssh" |