Skip to content

Instantly share code, notes, and snippets.

View elliotforbes's full-sized avatar
:octocat:

Elliot Forbes elliotforbes

:octocat:
View GitHub Profile
package main
import (
"encoding/json"
"fmt"
"log"
"github.com/graphql-go/graphql"
)
package main
import (
"encoding/json"
"fmt"
"log"
"github.com/graphql-go/graphql"
)
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
resource "aws_autoscaling_group" "example" {
launch_configuration = "${aws_launch_configuration.example.id}"
load_balancers = ["${aws_elb.example.name}"]
availability_zones = ["eu-west-1b", "eu-west-1a"]
min_size = 2
max_size = 5
tag {
key = "Name"
provider "aws" {
region = "eu-west-1"
}
data "aws_availability_zones" "available" {}
resource "aws_security_group" "instance" {
name = "go-api-instance"
ingress {
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-2757f631"
instance_type = "t2.micro"
}
FROM golang:latest
RUN mkdir /app
ADD ./pkg /app/
WORKDIR /app
RUN go get "github.com/gorilla/mux"
RUN go build -o main .
CMD ["/app/main"]
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
resource "aws_autoscaling_group" "example" {
launch_configuration = "${aws_launch_configuration.example.id}"
load_balancers = ["${aws_elb.example.name}"]
availability_zones = ["eu-west-1b", "eu-west-1a"]
min_size = 2
max_size = 5
tag {
key = "Name"
provider "aws" {
region = "eu-west-1"
}
data "aws_availability_zones" "available" {}
resource "aws_security_group" "instance" {
name = "go-api-instance"
ingress {