@@ -76,6 +76,8 @@ func FetchDetails(p *Preflight) error {
7676}
7777
7878func fetchOrg (p * Preflight ) error {
79+ p .verboseWriter .Write ("Discovering organization information" )
80+
7981 ctx := context .Background ()
8082 orgSvc := organizations .NewFromConfig (p .awsConfig )
8183
@@ -101,6 +103,8 @@ func fetchOrg(p *Preflight) error {
101103 p .details .IsManagementAccount = * orgOutput .Organization .MasterAccountId == p .caller .AccountID
102104 p .details .OrgID = * orgOutput .Organization .Id
103105
106+ p .verboseWriter .Write ("Discovering all accounts in the organization" )
107+
104108 // Get account IDs in the org
105109 accountsOutput , err := orgSvc .ListAccounts (ctx , nil )
106110 if err != nil {
@@ -110,12 +114,16 @@ func fetchOrg(p *Preflight) error {
110114 p .details .OrgAccountIDs = append (p .details .OrgAccountIDs , * a .Id )
111115 }
112116
117+ p .verboseWriter .Write ("Discovering root organization unit" )
118+
113119 // Get root org unit ID and all org unit IDs
114120 rootsOutput , err := orgSvc .ListRoots (ctx , nil )
115121 if err != nil {
116122 return err
117123 }
118124 if len (rootsOutput .Roots ) > 0 {
125+ p .verboseWriter .Write ("Discovering all organization units" )
126+
119127 p .details .RootOrgUnitID = * rootsOutput .Roots [0 ].Id
120128 orgUnitsOutput , err := orgSvc .ListOrganizationalUnitsForParent (
121129 ctx ,
@@ -131,6 +139,8 @@ func fetchOrg(p *Preflight) error {
131139 }
132140 }
133141
142+ p .verboseWriter .Write ("Discovering enabled services in the organization" )
143+
134144 // Check enabled services
135145 servicesOutput , err := orgSvc .ListAWSServiceAccessForOrganization (ctx , nil )
136146 if err != nil {
@@ -146,6 +156,8 @@ func fetchOrg(p *Preflight) error {
146156}
147157
148158func fetchRegions (p * Preflight ) error {
159+ p .verboseWriter .Write ("Discovering enabled regions" )
160+
149161 ec2Svc := ec2 .NewFromConfig (p .awsConfig )
150162 output , err := ec2Svc .DescribeRegions (context .Background (), nil )
151163 if err != nil {
@@ -197,6 +209,8 @@ To determine if an existing trail is eligible CloudTrail integration:
197209 4. No need to check KMS
198210*/
199211func fetchEligibleTrail (p * Preflight ) (* cloudtrailTypes.Trail , error ) {
212+ p .verboseWriter .Write ("Discovering existing eligible CloudTrail" )
213+
200214 ctx := context .Background ()
201215
202216 trailSvc := cloudtrail .NewFromConfig (p .awsConfig )
@@ -236,6 +250,8 @@ func fetchEligibleTrail(p *Preflight) (*cloudtrailTypes.Trail, error) {
236250}
237251
238252func fetchControlTowerTrail (p * Preflight ) (* cloudtrailTypes.Trail , error ) {
253+ p .verboseWriter .Write ("Discovering existing eligible CloudTrail for Control Tower" )
254+
239255 ctx := context .Background ()
240256
241257 trailSvc := cloudtrail .NewFromConfig (p .awsConfig )
@@ -276,6 +292,8 @@ func fetchControlTowerTrail(p *Preflight) (*cloudtrailTypes.Trail, error) {
276292}
277293
278294func fetchEKSClusters (p * Preflight ) error {
295+ p .verboseWriter .Write ("Discovering EKS clusters" )
296+
279297 var numRegions = len (p .details .Regions )
280298 var wg sync.WaitGroup
281299 var ch = make (chan EKSCluster , numRegions )
@@ -291,7 +309,7 @@ func fetchEKSClusters(p *Preflight) error {
291309 output , err := eksSvc .ListClusters (context .Background (), nil )
292310 if err != nil {
293311 logger .Log .Warnf (
294- "Discovering EKS Cluster details : unable to check region %s\n ERROR %s" ,
312+ "Discovering EKS Clusters : unable to check region %s. ERROR: %s" ,
295313 region , err .Error (),
296314 )
297315 } else {
0 commit comments