Skip to content

Instantly share code, notes, and snippets.

View OlegGorj's full-sized avatar
🎯
Focusing

Oleg Gorodnitchi OlegGorj

🎯
Focusing
View GitHub Profile
@OlegGorj
OlegGorj / bastion-jumphost.tf
Created March 18, 2018 17:43
Bastion/Jumphost with TF
variable "tag" {}
variable "vpc_id" {}
variable "cidr" {}
variable "region" {}
variable "image" {}
variable "key_name" {}
variable "instance_type" {}
variable "zone_id" {}
variable "domain" {}
variable "zones" {

This is simplest way to install and run docker with TF on your local Mac. If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider.

A few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

Alternatvly, use Terraform provider as already suggested but if you want to stick to docker-compose for any reason you can also create your docker-compose file and run the necessary commands with user-data. Take a look to template_file and template_cloudinit_config
### nginx.tpl
```
#cloud-config
write_files:
- content: |
version: '2'
services:
git clone https://github.com/vfarcic/k8s-specs.git

cd k8s-specs

git pull

open "https://console.aws.amazon.com/iam/home#/security_credential"

export AWS_ACCESS_KEY_ID=[...]

Quick snippet of the code to create node and spawn up docker container on it

resource "aws_instance" "docker" {
    connection {
        user = "ubuntu"
        key_file = "${lookup(var.key_path, var.aws_region)}"
    }
@OlegGorj
OlegGorj / final-option.md
Created March 22, 2018 16:27
Terraform - How to run remote-exec more than once

eventually found a solution:


resource "null_resource" "ansible" {

  triggers {
    key = "${uuid()}"
 }
@OlegGorj
OlegGorj / 0-base.tf
Created March 26, 2018 16:30
Patterns for extensible Terraform modules
# main.tf
provider "aws" {
region = "us-east-1"
}
module "myinstance" {
source ="./module"
}

Running Docker Commands Docker, Machine, and iOS Builds > Running Docker Commands

This document explains how to build Docker images for deploying elsewhere or for further testing and how to start services in remote docker containers in the following sections:

Overview Specifications Example Docker version Separation of Environments

kubectl get pods -a | grep -v Running | awk '{print $1}' | xargs kubectl delete pod
@OlegGorj
OlegGorj / Testing-functions.md
Last active April 8, 2018 18:53
GOlang examples and snippets

What does it mean that the ExampleReverse function "passes"?

As it executes the example, the testing framework captures data written to standard output and then compares the output against the example's "Output:" comment. The test passes if the test's output matches its output comment.

To see a failing example we can change the output comment text to something obviously incorrect

func ExampleReverse() {
 fmt.Println(stringutil.Reverse("hello"))