Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Prometheus based monitoring #33

Merged
merged 1 commit into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions cmd/terraformer/terraformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ const (
tfCmdPlan = "plan"
tfCmdRemote = "remote"

tplTFVars = `
domain = "{{.Domain}}"
tplTFVars = `domain = "{{.Domain}}"
key = {
access = "{{.KeyAccess}}"
}
pg_password = "{{.PGPassword}}"
`
google_client_id = "{{.GoogleID}}"
google_client_secret = "{{.GoogleSecret}}"`

varAccount = "account"
varEnv = "env"
Expand All @@ -77,9 +77,11 @@ pg_password = "{{.PGPassword}}"

// vars bundles together all generated or given input that is custom to the env.
type vars struct {
KeyAccess string
Domain string
PGPassword string
Domain string
GoogleID string
GoogleSecret string
KeyAccess string
PGPassword string
}

func main() {
Expand Down Expand Up @@ -205,15 +207,35 @@ func main() {
log.Fatal("Can't work without a domain.")
}

fmt.Println("\nIn order to guard the monitoring setup we need Google OAuth credentials.\nWhat is your Google client ID?")
fmt.Print("|> ")
googleID := ""
fmt.Scanf("%s", &googleID)

if googleID == "" {
log.Fatal("Can't work without a Google OAuth credentials.")
}

fmt.Println("\nWhat is your Google client Secret?")
fmt.Print("|> ")
googleSecret := ""
fmt.Scanf("%s", &googleSecret)

if googleSecret == "" {
log.Fatal("Can't work without a Google OAuth credentials.")
}

pubKey, err := generateKeyPair(filepath.Join(statePath, defaultKeyPath))
if err != nil {
log.Fatal(err)
}

if err = generateVarFile(varFile, vars{
Domain: domain,
KeyAccess: strings.Trim(string(pubKey), "\n"),
PGPassword: generate.RandomStringSafe(32),
Domain: domain,
GoogleID: googleID,
GoogleSecret: googleSecret,
KeyAccess: strings.Trim(string(pubKey), "\n"),
PGPassword: generate.RandomStringSafe(32),
}); err != nil {
log.Fatalf("var file create failed: %s", err)
}
Expand Down
Loading