Skip to content

Instantly share code, notes, and snippets.

View soerenmartius's full-sized avatar
🎯
focused

Sören Martius soerenmartius

🎯
focused
View GitHub Profile
@soerenmartius
soerenmartius / multithreading.go
Created May 5, 2020 09:40
Multithreading Example with WaitGroups in Golang
package main
import (
"fmt"
"sync"
"time"
)
func worker(wg *sync.WaitGroup, id int) {
defer wg.Done()
@soerenmartius
soerenmartius / repository.tf
Last active March 29, 2020 17:23
GitHub Repository with Branch Protection Rule
module "iac-github" {
source = "mineiros-io/repository/github"
version = "~> 0.1.0"
name = "iac-github"
private = true
description = "An example on how to manage a GitHub organization with Terraform."
allow_merge_commit = true
@soerenmartius
soerenmartius / deploy.yml
Last active March 29, 2020 17:21
SemaphoreCI Terraform Deployment Pipeline.
version: v1.0
name: "Deploy to GitHub"
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
global_job_config:
env_vars:
- name: BUILD_TOOLS_VERSION
@soerenmartius
soerenmartius / semaphore.yml
Created March 29, 2020 17:18
SemaphoreCI Pipeline Configuration
version: v1.0
name: "IaC-Github CI Pipeline"
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
global_job_config:
env_vars:
- name: BUILD_TOOLS_VERSION
@soerenmartius
soerenmartius / repository.tf
Created March 29, 2020 17:08
Create new GitHub Repository with Terraform
module "iac-github" {
source = "mineiros-io/repository/github"
version = "~>0.1.0"
name = "iac-github"
private = true
description = "An example on how to manage a GitHub organization with Terraform."
allow_merge_commit = true
@soerenmartius
soerenmartius / Makefile
Created March 29, 2020 16:24
Makefile with Terraform targets
SHELL := /bin/bash
MOUNT_TARGET_DIRECTORY = /app/src
BUILD_TOOLS_DOCKER_REPO = mineiros/build-tools
# Set default value for environment variable if there aren't set already
ifndef BUILD_TOOLS_VERSION
BUILD_TOOLS_VERSION := latest
endif
@soerenmartius
soerenmartius / provider.tf
Created March 29, 2020 16:18
Terraform with S3 Remote State and DynamoDB State Locks
# ---------------------------------------------------------------------------------------------------------------------
# SET TERRAFORM AND PROVIDER REQUIREMENTS
# ---------------------------------------------------------------------------------------------------------------------
terraform {
required_version = "~> 0.12.24"
backend "s3" {
bucket = "github-terraform-example-terraform-state"
key = "organization/github-terraform-example/terraform.tfstate"
@soerenmartius
soerenmartius / provider.tf
Created March 29, 2020 15:40
Terraform provider without s3 and state locks
# ---------------------------------------------------------------------------------------------------------------------
# SET TERRAFORM AND PROVIDER REQUIREMENTS
# ---------------------------------------------------------------------------------------------------------------------
terraform {
required_version = "~> 0.12.24"
required_providers {
aws = "~> 2.4"
}
@soerenmartius
soerenmartius / aws.tf
Last active March 29, 2020 15:39
Create S3 Bucket, DynamoDB Table and new User for Terraform
# ---------------------------------------------------------------------------------------------------------------------
# Create the S3 Bucket and DynamoDB Table
# ---------------------------------------------------------------------------------------------------------------------
module "terraform_state_s3_bucket" {
source = "mineiros-io/s3-bucket/aws"
version = "~> 0.1.2"
bucket = "github-terraform-example-terraform-state"
versioning = {
@soerenmartius
soerenmartius / import.tf
Created March 5, 2020 17:40
How to manage your GitHub Organization with Terraform - Import Resources
module "repository" {
source = "mineiros-io/repository/github"
version = "0.1.0"
name = "i-love-teraform"
}