@@ -46,6 +46,7 @@ import (
4646 "github.com/aws/aws-sdk-go/service/elb"
4747 "github.com/aws/aws-sdk-go/service/iam"
4848 "github.com/aws/aws-sdk-go/service/servicequotas"
49+ "github.com/aws/aws-sdk-go/service/sts"
4950 cfn_iam "github.com/awslabs/goformation/v4/cloudformation/iam"
5051 . "github.com/onsi/ginkgo/v2"
5152 . "github.com/onsi/gomega"
@@ -635,6 +636,19 @@ func GetPolicyArn(prov client.ConfigProvider, name string) string {
635636 return ""
636637}
637638
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+
638652// deleteCloudFormationStack removes the provisioned clusterawsadm stack.
639653func deleteCloudFormationStack (prov client.ConfigProvider , t * cfn_bootstrap.Template ) {
640654 By (fmt .Sprintf ("Deleting %s CloudFormation stack" , t .Spec .StackName ))
@@ -837,7 +851,7 @@ func DumpCloudTrailEvents(e2eCtx *E2EContext) {
837851 if err != nil {
838852 fmt .Fprintf (GinkgoWriter , "Failed to marshal AWS CloudTrail events: err=%v" , err )
839853 }
840- if err := os .WriteFile (logPath , dat , 0600 ); err != nil {
854+ if err := os .WriteFile (logPath , dat , 0o600 ); err != nil {
841855 fmt .Fprintf (GinkgoWriter , "couldn't write cloudtrail events to file: file=%s err=%s" , logPath , err )
842856 return
843857 }
@@ -1008,7 +1022,7 @@ func dumpEKSCluster(cluster *eks.Cluster, logPath string) {
10081022 }
10091023 defer f .Close ()
10101024
1011- if err := os .WriteFile (f .Name (), clusterYAML , 0600 ); err != nil {
1025+ if err := os .WriteFile (f .Name (), clusterYAML , 0o600 ); err != nil {
10121026 fmt .Fprintf (GinkgoWriter , "couldn't write cluster yaml to file: name=%s file=%s err=%s" , * cluster .Name , f .Name (), err )
10131027 return
10141028 }
0 commit comments