@@ -46,6 +46,7 @@ import (
46
46
"github.com/aws/aws-sdk-go/service/elb"
47
47
"github.com/aws/aws-sdk-go/service/iam"
48
48
"github.com/aws/aws-sdk-go/service/servicequotas"
49
+ "github.com/aws/aws-sdk-go/service/sts"
49
50
cfn_iam "github.com/awslabs/goformation/v4/cloudformation/iam"
50
51
. "github.com/onsi/ginkgo/v2"
51
52
. "github.com/onsi/gomega"
@@ -635,6 +636,19 @@ func GetPolicyArn(prov client.ConfigProvider, name string) string {
635
636
return ""
636
637
}
637
638
639
+ func logAccountDetails (prov client.ConfigProvider ) {
640
+ By ("Getting AWS account details" )
641
+ stsSvc := sts .New (prov )
642
+
643
+ output , err := stsSvc .GetCallerIdentity (& sts.GetCallerIdentityInput {})
644
+ if err != nil {
645
+ fmt .Fprintf (GinkgoWriter , "couldn't get sts caller identity: err=%s" , err )
646
+ return
647
+ }
648
+
649
+ fmt .Fprintf (GinkgoWriter , "Using AWS account: %s" , * output .Account )
650
+ }
651
+
638
652
// deleteCloudFormationStack removes the provisioned clusterawsadm stack.
639
653
func deleteCloudFormationStack (prov client.ConfigProvider , t * cfn_bootstrap.Template ) {
640
654
By (fmt .Sprintf ("Deleting %s CloudFormation stack" , t .Spec .StackName ))
@@ -837,7 +851,7 @@ func DumpCloudTrailEvents(e2eCtx *E2EContext) {
837
851
if err != nil {
838
852
fmt .Fprintf (GinkgoWriter , "Failed to marshal AWS CloudTrail events: err=%v" , err )
839
853
}
840
- if err := os .WriteFile (logPath , dat , 0600 ); err != nil {
854
+ if err := os .WriteFile (logPath , dat , 0o600 ); err != nil {
841
855
fmt .Fprintf (GinkgoWriter , "couldn't write cloudtrail events to file: file=%s err=%s" , logPath , err )
842
856
return
843
857
}
@@ -1008,7 +1022,7 @@ func dumpEKSCluster(cluster *eks.Cluster, logPath string) {
1008
1022
}
1009
1023
defer f .Close ()
1010
1024
1011
- if err := os .WriteFile (f .Name (), clusterYAML , 0600 ); err != nil {
1025
+ if err := os .WriteFile (f .Name (), clusterYAML , 0o600 ); err != nil {
1012
1026
fmt .Fprintf (GinkgoWriter , "couldn't write cluster yaml to file: name=%s file=%s err=%s" , * cluster .Name , f .Name (), err )
1013
1027
return
1014
1028
}
0 commit comments