Example #1
0
func generate(source io.Reader) {
	var spec builder.DeploymentSpec

	var err error

	err = candiedyaml.NewDecoder(source).Decode(&spec)
	if err != nil {
		panic(err)
	}

	former := aws.New(spec.Description)

	region := os.Getenv("AWS_DEFAULT_REGION")
	if region == "" {
		region = "us-east-1"
	}

	builder := builder.New(spec, region)

	err = builder.Build(former)
	if err != nil {
		panic(err)
	}

	err = json.NewEncoder(os.Stdout).Encode(former.Template)
	if err != nil {
		fatal(err)
	}
}
Example #2
0
func main() {
	aws := aws.New("test template")

	Form(aws)

	json.NewEncoder(os.Stdout).Encode(aws.Template)
}
Example #3
0
package aws_test

import (
	"encoding/json"

	"github.com/vito/cloudformer/aws"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("AWSCloudFormer", func() {
	It("creates a DNS A record for an elastic IP", func() {
		f := aws.New("elastic IP with A record")

		eip := f.ElasticIP("bosh")

		recordSet := f.RecordSet("bosh")
		recordSet.HostedZoneName("test.com.")
		recordSet.Name("bosh.test.com")
		recordSet.TTL(300)
		recordSet.PointTo(eip)

		Expect(json.Marshal(f.Template)).To(MatchJSON(`
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "elastic IP with A record",
  "Mappings": {},
  "Resources": {
    "boshEIP": {
      "Type": "AWS::EC2::EIP"