forked from errordeveloper/goformation
/
main.go
39 lines (29 loc) · 872 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"os"
)
func main() {
fmt.Printf("GoFormation Resource Generator\n")
cloudformationSpec := "https://d1uauaxba7bl26.cloudfront.net/latest/gzip/CloudFormationResourceSpecification.json"
otherSpecs := map[string]string{
"sam": "file://generate/sam-2016-10-31.json",
}
rg, err := NewResourceGenerator(cloudformationSpec, otherSpecs)
if err != nil {
fmt.Printf("ERROR: %s\n", err)
os.Exit(1)
}
if err := rg.Generate(); err != nil {
fmt.Printf("ERROR: Failed to generate resources: %s\n", err)
os.Exit(1)
}
if len(rg.Results.UpdatedResources) > 0 {
fmt.Printf("\nUpdated the following AWS CloudFormation resources:\n\n")
for _, updated := range rg.Results.UpdatedResources {
fmt.Printf(" - %s\n", updated)
}
fmt.Printf("\n")
}
fmt.Printf("Processed %d resources\n", rg.Results.ProcessedCount)
}