Created
April 9, 2018 10:17
-
-
Save ritesh/9aa39b3a58bf637836c904299c615b9f to your computer and use it in GitHub Desktop.
goformation example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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