Skip to content

Instantly share code, notes, and snippets.

View nicosingh's full-sized avatar

Nico Singh nicosingh

View GitHub Profile
resource "aws_acm_certificate" "certificate" {
certificate_body = acme_certificate.certificate.certificate_pem
private_key = acme_certificate.certificate.private_key_pem
certificate_chain = acme_certificate.certificate.issuer_pem
}
#!/bin/bash
amazon-linux-extras install nginx1 -y
chkconfig nginx on
service nginx start
# . . . remaining part of /etc/gitlab-runner/config.toml
[runners.machine]
MachineDriver = "azure"
MachineName = "gitlab-docker-machine-%s"
MachineOptions = [
"azure-subscription-id=xxx",
"azure-client-id=xxx",
"azure-client-secret=xxx",
"azure-resource-group=gitlab-ci",
# . . . remaining part of /etc/gitlab-runner/config.toml
[runners.machine]
MachineDriver = "google"
MachineName = "gitlab-docker-machine-%s"
MachineOptions = [
"google-project=xxxxx",
"google-network=xxxxx",
"google-subnetwork=xxxxx",
"google-use-internal-ip=true",
# . . . remaining part of /etc/gitlab-runner/config.toml
[runners.machine]
MachineDriver = "amazonec2"
MachineName = "gitlab-docker-machine-%s"
MachineOptions = [
"amazonec2-access-key=XXXX",
"amazonec2-secret-key=XXXX",
"amazonec2-region=us-central-1",
"amazonec2-vpc-id=vpc-xxxxx",
# /etc/gitlab-runner/config.toml
concurrent = 10
[[runners]]
name = "gitlab-ci-runner-bastion"
url = "https://gitlab.com/"
token = "our-own-gitlab-token-goes-here"
executor = "docker+machine"
[runners.docker]
terraform {
required_version = "~> 1.9.5"
required_providers {
acme = {
source = "vancluever/acme"
version = "~> 2.5.3"
}
aws = {
source = "hashicorp/aws"
output "certificate_pem" {
value = acme_certificate.certificate.certificate_pem
}
output "issuer_pem" {
value = acme_certificate.certificate.issuer_pem
}
output "private_key_pem" {
value = nonsensitive(acme_certificate.certificate.private_key_pem)
resource "aws_s3_object" "certificate_artifacts_s3_objects" {
for_each = toset(["certificate_pem", "issuer_pem", "private_key_pem"])
bucket = "test-singh-cl-ssl-cert" # TODO put your own S3 bucket, and create it before if necessary!
key = each.key # TODO prefix with your own bucket path if there is any
content = lookup(acme_certificate.certificate, "${each.key}")
}
provider "acme" {
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory"
#server_url = "https://acme-v02.api.letsencrypt.org/directory"
}
data "aws_route53_zone" "base_domain" {
name = "eks.singh.cl" # TODO put your own DNS in here!
}
resource "tls_private_key" "private_key" {