aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2023-03-01 11:36:41 -0600
committerKelley Spoon <kelley.spoon@linaro.org>2023-03-01 11:36:41 -0600
commit5af76466fb97563e7453e4daa86f9e78011ba4dd (patch)
tree14aaaaf39d7ffc840ccbbd13c4cadb9622648a0c
parentc8f688054878041e439c1dd4b3fddf101a88e08e (diff)
buildkite: add to playbookHEADmaster
Signed-off-by: Kelley Spoon <kelley.spoon@linaro.org> Change-Id: I5a2d870724c31fe3b17adc17f903eddc2386978e
l---------buildkite/.role.conf1
-rw-r--r--buildkite/buildkite.tf71
-rw-r--r--buildkite/terraform.tfvars3
3 files changed, 75 insertions, 0 deletions
diff --git a/buildkite/.role.conf b/buildkite/.role.conf
new file mode 120000
index 0000000..7ba25d6
--- /dev/null
+++ b/buildkite/.role.conf
@@ -0,0 +1 @@
+../.role.conf \ No newline at end of file
diff --git a/buildkite/buildkite.tf b/buildkite/buildkite.tf
new file mode 100644
index 0000000..16f7ade
--- /dev/null
+++ b/buildkite/buildkite.tf
@@ -0,0 +1,71 @@
+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/buildkite.tfstate"
+ region = "us-east-1"
+ skip_region_validation = true
+ }
+}
+
+data "terraform_remote_state" "vpc" {
+ backend = "s3"
+ config = {
+ bucket = "linaro-terraform-state"
+ key = "lss/production/vpc-global.tfstate"
+ region = "us-east-1"
+ }
+}
+
+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" "buildkite" {
+ ami = "${data.aws_ami.ubuntu.id}"
+ instance_type = "t3.small"
+ subnet_id = "${data.terraform_remote_state.vpc.us-ctt-subnet-id}"
+ vpc_security_group_ids = [ "${data.terraform_remote_state.vpc.us-ctt-sg-id}",
+ "${data.terraform_remote_state.vpc.us-ctt-web-sg-id}" ]
+ key_name = "${var.ami_key_pair_name}"
+ tags = {
+ Name = "buildkite"
+ }
+
+ root_block_device = {
+ delete_on_termination = false
+ volume_size = 100
+ #tags = {
+ # Backup = "yes"
+ # Name = "buildkite DATA"
+ #}
+ }
+}
+
+resource "aws_eip" "buildkite-ip" {
+ instance = "${aws_instance.buildkite.id}"
+ vpc = true
+}
+
+resource "aws_route53_record" "buildkite-dns" {
+ zone_id = "${var.route53_zone_id}"
+ name = "buildkite"
+ type = "A"
+ ttl = "60"
+ records = ["${aws_eip.buildkite-ip.public_ip}"]
+}
diff --git a/buildkite/terraform.tfvars b/buildkite/terraform.tfvars
new file mode 100644
index 0000000..7e1d358
--- /dev/null
+++ b/buildkite/terraform.tfvars
@@ -0,0 +1,3 @@
+route53_zone_id = "Z27NRA2FV79C84"
+route53_zone_name = "ctt.linaro.org"
+ami_key_pair_name = "systems-bot-ssh"