Skip to content

GCP-XXXX: Skip Projects And Folders if Display Name Not Provided#86

Merged
tedkahwaji merged 1 commit into
mainfrom
teddy.kahwaji/gcp-xxxx/missing-project-name-remediation
Nov 12, 2025
Merged

GCP-XXXX: Skip Projects And Folders if Display Name Not Provided#86
tedkahwaji merged 1 commit into
mainfrom
teddy.kahwaji/gcp-xxxx/missing-project-name-remediation

Conversation

@tedkahwaji
Copy link
Copy Markdown
Collaborator

@tedkahwaji tedkahwaji commented Nov 12, 2025

Summary

This update resolves a KeyError reported by a customer when attempting to extract the 'name' attribute from the gcloud projects list output.

It was determined that a display name is not strictly required when creating a project or folder using the gcloud CLI or the Cloud Resource Manager API. However, the Google Cloud Console UI does enforce providing one during creation.

Once a project or folder has been assigned a display name, it cannot be cleared or removed through any method—whether via gcloud, the Resource Manager API, or the UI.

This change addresses this edge case by ensuring that when a folder or project does not have a display name, it is simply excluded from scope collection.

@tedkahwaji tedkahwaji force-pushed the teddy.kahwaji/gcp-xxxx/missing-project-name-remediation branch from 0ee0903 to ee369d4 Compare November 12, 2025 15:17
@tedkahwaji tedkahwaji changed the title GCP-XXXX: Update Project/Folder Payload to Use ID instead of Display Name When Missing GCP-XXXX: Skip Projects And Folders if Display Name Not Provided Nov 12, 2025
@tedkahwaji tedkahwaji marked this pull request as ready for review November 12, 2025 15:40
@tedkahwaji tedkahwaji requested a review from a team as a code owner November 12, 2025 15:40
@tedkahwaji tedkahwaji requested review from dtru-ddog and removed request for a team November 12, 2025 15:40
Copy link
Copy Markdown

@dtru-ddog dtru-ddog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding check overall makes sense

parent = f["parent"]
folder = Folder(name=f["displayName"], id=f["name"].split("/")[1], parent_id="")
if "displayName" not in f:
continue
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably just log the output as debug and note we're skipping.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline; that logging here would purely occur on the customer environment. We could potentially have print a message here indicating this skip is happening

@tedkahwaji tedkahwaji force-pushed the teddy.kahwaji/gcp-xxxx/missing-project-name-remediation branch from ee369d4 to 398aa78 Compare November 12, 2025 16:08
@tedkahwaji tedkahwaji merged commit 5408e92 into main Nov 12, 2025
2 checks passed
@tedkahwaji tedkahwaji deleted the teddy.kahwaji/gcp-xxxx/missing-project-name-remediation branch November 12, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants