Skip to content

Instantly share code, notes, and snippets.

@fguisso
Created April 8, 2022 19:17
Show Gist options
  • Save fguisso/ff1ef87d218ec364f9f15cb087d530c7 to your computer and use it in GitHub Desktop.
Save fguisso/ff1ef87d218ec364f9f15cb087d530c7 to your computer and use it in GitHub Desktop.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
}
}
required_version = ">= 0.14.9"
}
provider "aws" {
profile = "default"
region = "us-east-1"
}
data "aws_availability_zones" "all_azs" {
state = "available"
}
resource "aws_launch_template" "ec2_launch_template" {
name = "github_runner_launch_template"
description = "Launch Template for GitHub Runners EC2"
image_id = var.ami
instance_type = var.instance_type
key_name = var.key_name
user_data = base64encode(templatefile("${path.cwd}/bootstrap.tmpl", { github_repo_url = var.github_repo_url, github_repo_pat_token = var.github_repo_pat_token, runner_name = var.runner_name, labels = join(",", var.labels) }))
tags = {
Name = "github_runner"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment