Skip to content

Commit b8d0c05

Browse files
authored
Merge pull request goadapp#148 from cwaltken-edrans/detect-old-iam-role
Detect old iam role and prompt the user
2 parents c1a299f + 8575526 commit b8d0c05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+15892
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ data/lambda/goad-lambda
55
infrastructure/bindata.go
66
site/Upstatic
77
build/
8+
goad.ini
89

910
*debug*
1011

Gopkg.lock

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

infrastructure/aws/aws.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import (
77
"encoding/json"
88
"fmt"
99
"io"
10+
"os"
1011
"path"
12+
"time"
1113

14+
"github.com/Songmu/prompter"
1215
"github.com/aws/aws-sdk-go/aws"
1316
"github.com/aws/aws-sdk-go/aws/awserr"
1417
"github.com/aws/aws-sdk-go/aws/session"
@@ -20,6 +23,10 @@ import (
2023
uuid "github.com/satori/go.uuid"
2124
)
2225

26+
var (
27+
roleDate = time.Date(2017, 07, 13, 18, 40, 0, 0, time.UTC)
28+
)
29+
2330
// AwsInfrastructure manages the resource creation and updates necessary to use
2431
// Goad.
2532
type AwsInfrastructure struct {
@@ -281,9 +288,18 @@ func (infra *AwsInfrastructure) createIAMLambdaRole(roleName string) (arn string
281288
return "", err
282289
}
283290

291+
CheckRoleDate(resp.Role)
284292
return *resp.Role.Arn, nil
285293
}
286294

295+
func CheckRoleDate(role *iam.Role) {
296+
if role.CreateDate.Before(roleDate) {
297+
if !prompter.YN("Your IAM role for goad might be outdated, continue anyways?", true) {
298+
os.Exit(0)
299+
}
300+
}
301+
}
302+
287303
func (infra *AwsInfrastructure) createIAMLambdaRolePolicy(roleName string) error {
288304
svc := iam.New(session.New(), infra.config)
289305

vendor/github.com/Songmu/prompter/.travis.yml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Songmu/prompter/LICENSE

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Songmu/prompter/Makefile

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Songmu/prompter/README.md

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Songmu/prompter/exam_test.go

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Songmu/prompter/funcs.go

Lines changed: 72 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/Songmu/prompter/funcs_test.go

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)