Skip to content

Instantly share code, notes, and snippets.

@ritesh
Created April 9, 2018 10:17
Show Gist options
  • Select an option

  • Save ritesh/9aa39b3a58bf637836c904299c615b9f to your computer and use it in GitHub Desktop.

Select an option

Save ritesh/9aa39b3a58bf637836c904299c615b9f to your computer and use it in GitHub Desktop.
goformation example
package main
import (
"log"
"github.com/awslabs/goformation"
)
func main() {
//template.yaml looks like this
// AWSTemplateFormatVersion: 2010-09-09
// Resources:
// MyRoute53HostedZone:
// Type: AWS::Route53::HostedZone
// Properties:
// Name: example.com
// MySNSTopic:
// Type: AWS::SNS::Topic
// Properties:
// DisplayName: test-sns-topic-display-name
// Subscription:
// - Endpoint: test-sns-topic-subscription-endpoint
// Protocol: test-sns-topic-subscription-protocol
// TopicName: test-sns-topic-name
// ...or provide one as a byte array ([]byte)
template, err := goformation.Open("template.yaml")
if err != nil {
log.Fatalf("err")
}
zones := template.GetAllAWSRoute53HostedZoneResources()
if zones == nil {
//NO ZONES LOL
log.Fatalf("err")
}
log.Printf("%v", zones)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment