Browse Source

ensure dir exists

pull/78/head
Chris Mague 6 years ago
parent
commit
46258fbd80
  1. 6
      plugin.go
  2. 1
      terraform.go

6
plugin.go

@ -61,7 +61,7 @@ func (p Plugin) Exec() error {
// Install a extra PEM key if required
if len(os.Getenv("PEM_NAME")) > 0 {
fmt.Println("--- Setting a pem file")
fmt.Println("--- Setting a pem file ---")
value, exists := os.LookupEnv("PEM_CONTENTS")
if !exists {
value = "-----BEGIN RSA PRIVATE KEY-----\n\n-----END RSA PRIVATE KEY-----\n"
@ -75,7 +75,7 @@ func (p Plugin) Exec() error {
// Install a Github SSH key
if len(os.Getenv("GITHUB_PRIVATE_SSH_KEY")) > 0 {
fmt.Println("--- Setting a Github key")
fmt.Println("--- Setting a Github key ---")
sshconfErr := installGithubSsh(os.Getenv("GITHUB_PRIVATE_SSH_KEY"))
if sshconfErr != nil {
@ -84,7 +84,7 @@ func (p Plugin) Exec() error {
}
// Install an AWS profile if env var is set
fmt.Println("--- Setting an AWS profile")
fmt.Println("--- Setting an AWS profile ---")
if len(os.Getenv("AWS_ACCESS_KEY_ID")) > 0 {
profileErr := installProfile(os.Getenv("AWS_PROFILE"), os.Getenv("AWS_ACCESS_KEY_ID"), os.Getenv("AWS_SECRET_ACCESS_KEY"))

1
terraform.go

@ -18,6 +18,7 @@ type (
)
func installExtraPem(pemName string, pemContents string) error {
os.Mkdir(os.Getenv("HOME")+"/.ssh", 0700)
err := ioutil.WriteFile(os.Getenv("HOME")+"/.ssh/"+pemName, []byte(pemContents), 0600)
if err != nil {
return err

Loading…
Cancel
Save