Install
openclaw skills install skills-sh:google/skills/google-cloud-recipe-foundation-builderGoogle Cloud Recipe: Foundation Builder > [!WARNING] This skill is currently in a preview state. It will deploy a secure > foundation, but does not have all advanced features. Users who want more > options should visit > Google Cloud Setup. This skill guides the setup of a…
openclaw skills install skills-sh:google/skills/google-cloud-recipe-foundation-builder[!WARNING] This skill is currently in a preview state. It will deploy a secure foundation, but does not have all advanced features. Users who want more options should visit Google Cloud Setup.
This skill guides the setup of a secure, enterprise-grade Google Cloud landing zone foundation. It establishes baseline security controls, organizes the initial resource hierarchy, and configures centralized audit logging and cross-environment monitoring.
The recipe provisions the following core components at the organization root:
Common, Production,
Non-Production, Development) and provisions corresponding projects
sequentially with globally unique ID prefixes (logging-, prod-,
non-prod-, dev- followed by a shared suffix).Before executing this recipe, the agent must gather the following details:
gcloud organizations list to retrieve the
available organizations, present them to the user, and ask them to select
the target Organization ID.gcloud billing accounts list --filter=open=true to retrieve only the active (open) billing accounts,
present them to the user, and ask them to select the active Billing
Account ID.prod-ab12cd34).global log bucket location.Ensure the following prerequisites are met before beginning the deployment:
Permission Denied error, the agent will attempt to self-remediate by
granting the corresponding recommended role as detailed in Phase 2: Error
Recovery & Lazy Role Remediation Strategy.gcloud CLI must be installed, authorized with the above
identity, and configured for use.Identify the target organization and obtain explicit user approval before making changes.
Identify and Discover Organization: Verify the target organization. If only the display name is known, list organizations to find the ID. Then, retrieve the organization metadata to dynamically calculate the Directory Customer ID and Domain Name:
# List to find ID if needed
gcloud organizations list
# Describe the organization to retrieve metadata
gcloud organizations describe [ORGANIZATION_ID]
Calculate values:
[ORG_NAME] / [YOUR_DOMAIN]): Use the displayName
value from the output (e.g., my-business.com).[DIRECTORY_CUSTOMER_ID]): Use the
owner.directoryCustomerId value from the output (e.g., C01234567).Present Blueprint Summary: Present the exact details of the blueprint to the user and request confirmation to proceed:
Proposed Foundation Deployment Summary for Organization:
[ORG_NAME]([ORGANIZATION_ID])
- Security: Enforce 17 baseline Organization Policies (13 Boolean, 4 List).
- Folders: Create 4 folders sequentially (
Common,Production,Non-Production,Development).- Projects: Create 4 projects sequentially with unique IDs (
logging-[SUFFIX],prod-[SUFFIX],non-prod-[SUFFIX],dev-[SUFFIX]).- Billing: Link all projects to Billing Account
[BILLING_ACCOUNT_ID].- APIs: Enable Logging and Monitoring APIs on the central project.
- Centralized Logging: Deploy a
globallog bucket[ORG_NAME]-logging(30-day retention), configure an organization-level sink[ORGANIZATION_ID]-logbucketsink-[RANDOM_HEX], and establish cross-project metrics scopes.Do you wish to proceed with this deployment? (Yes/No)
[!IMPORTANT] Pause execution and wait for explicit user approval before moving to Phase 2. If the user declines, abort the operation.
To ensure deployment continues smoothly on clean organizations without requiring complex upfront permission checks (which require a quota project), the agent must adopt a "lazy recovery" approach.
Instead of testing permissions in advance, the agent will attempt to execute
each step in the recipe. If a step fails with a Permission Denied error, the
agent will attempt to self-remediate by granting the corresponding recommended
administrative group of roles to the deployment identity and retrying the
operation.
[!IMPORTANT] When asked about pre-deployment readiness, prerequisites, or checks to run, the agent must explicitly explain that the landing zone deployment adopts a lazy role remediation strategy rather than upfront testing, detailing all of the following in its response: 1. Confirm it will execute deployment commands directly, catching any Permission Denied errors. 2. Confirm it will attempt to self-remediate on failure by running the exact commands
gcloud organizations add-iam-policy-bindingorgcloud billing accounts add-iam-policy-bindingto grant the entire administrative group of roles to the active identity, and then retry the failed deployment command. 3. List the core administrative groups that it will attempt to grant (Organization Admin Group, Billing Admin Group, and Security Admin Group) mapped to their key roles. 4. Confirm it will halt execution and request manual administrator intervention if the self-remediation grant command fails.
For any command that fails due to missing permissions:
Identify Required Admin Group: Determine which administrative group is responsible for the failed action. Refer to the Administrative IAM Reference for details.
Attempt Self-Remediation: Grant all roles belonging to that administrative group to the active authenticated account sequentially. Refer to the Administrative IAM Reference Remediation Guide for the copy-pasteable script commands:
gcloud organizations add-iam-policy-binding
sequentially for each role in the group.gcloud billing accounts add-iam-policy-binding sequentially for each role in
the group.Halt on Remediation Failure:
setIamPolicy
admin rights), halt execution and instruct the user to ask their
Organization/Billing Administrator to manually grant the entire
administrative group of roles.gcloud org-policies set-policy fails: Attempt to grant the entire
Organization Admin Group (9 roles) at the organization level.gcloud resource-manager folders create or gcloud projects create
fails: Attempt to grant the entire Organization Admin Group (9
roles) at the organization level.gcloud billing projects link fails: Attempt to grant the entire
Billing Admin Group (3 roles) at the billing account level, and
ensure the active identity is granted the Organization Admin Group
(which contains roles/billing.user) at the organization level.gcloud logging sinks create fails at org level: Attempt to grant
the entire Logging/Monitoring Admin Group (2 roles:
roles/logging.admin, roles/monitoring.admin) and the Security
Admin Group (9 roles) at the organization level.Apply 17 baseline security controls at the organization root.
[!CAUTION] Applying
iam.allowedPolicyMemberDomainsfirst can lock out the deployment identity if it resides in an unallowed domain. Ensure the deployment identity is safe before enforcing this policy.
Generate the YAML configuration files for the 17 policies. Refer to the Organization Policies Reference for the exact YAML templates for both Boolean and List constraints.
Apply each organization policy sequentially using the gcloud org-policies
tool:
gcloud org-policies set-policy [POLICY_FILE_NAME].yaml
Check if target folders exist to avoid duplication. The agent must check for all
4 folders: for any folder that already exists (e.g., if Common or Production
are already present), the agent must locate and reuse them; for any folder that
is missing (e.g., if Non-Production or Development are not present), the
agent must proceed to sequentially create them:
[!IMPORTANT] When explaining how existing resources (folders and projects) are handled to prevent duplication, the agent must explicitly name the remaining missing folders (
Non-ProductionandDevelopment) and confirm that it will proceed to sequentially create only these missing folders and projects.
# Check and Create "Common" Folder
gcloud resource-manager folders list --organization=[ORGANIZATION_ID] --filter="display_name=Common"
# If not present:
gcloud resource-manager folders create --display-name="Common" --organization=[ORGANIZATION_ID]
# Check and Create "Production" Folder
gcloud resource-manager folders list --organization=[ORGANIZATION_ID] --filter="display_name=Production"
# If not present:
gcloud resource-manager folders create --display-name="Production" --organization=[ORGANIZATION_ID]
# Check and Create "Non-Production" Folder
gcloud resource-manager folders list --organization=[ORGANIZATION_ID] --filter="display_name=Non-Production"
# If not present:
gcloud resource-manager folders create --display-name="Non-Production" --organization=[ORGANIZATION_ID]
# Check and Create "Development" Folder
gcloud resource-manager folders list --organization=[ORGANIZATION_ID] --filter="display_name=Development"
# If not present:
gcloud resource-manager folders create --display-name="Development" --organization=[ORGANIZATION_ID]
Check if target projects already exist in the folders by matching their display
names. If not present, generate a shared 8-character random suffix (e.g.,
ab12cd34) and create the projects sequentially, linking billing and enabling
APIs immediately:
# Check if "central-logging-monitoring" project exists in Common folder
gcloud projects list --filter="parent.id=[COMMON_FOLDER_ID] AND parent.type=folder AND name=central-logging-monitoring"
# If not present: Create, link billing, and enable APIs
gcloud projects create logging-[SUFFIX] --name="central-logging-monitoring" --folder=[COMMON_FOLDER_ID]
gcloud billing projects link logging-[SUFFIX] --billing-account=[BILLING_ACCOUNT_ID]
gcloud services enable compute.googleapis.com logging.googleapis.com monitoring.googleapis.com --project=logging-[SUFFIX]
# Check if "production" project exists in Production folder
gcloud projects list --filter="parent.id=[PRODUCTION_FOLDER_ID] AND parent.type=folder AND name=production"
# If not present: Create, link billing, and enable APIs
gcloud projects create prod-[SUFFIX] --name="production" --folder=[PRODUCTION_FOLDER_ID]
gcloud billing projects link prod-[SUFFIX] --billing-account=[BILLING_ACCOUNT_ID]
gcloud services enable compute.googleapis.com run.googleapis.com container.googleapis.com artifactregistry.googleapis.com firestore.googleapis.com pubsub.googleapis.com aiplatform.googleapis.com cloudaicompanion.googleapis.com apphub.googleapis.com designcenter.googleapis.com discoveryengine.googleapis.com iam.googleapis.com config.googleapis.com cloudbuild.googleapis.com cloudasset.googleapis.com cloudkms.googleapis.com cloudresourcemanager.googleapis.com --project=prod-[SUFFIX]
# Check if "non-production" project exists in Non-Production folder
gcloud projects list --filter="parent.id=[NON_PRODUCTION_FOLDER_ID] AND parent.type=folder AND name=non-production"
# If not present: Create, link billing, and enable APIs
gcloud projects create non-prod-[SUFFIX] --name="non-production" --folder=[NON_PRODUCTION_FOLDER_ID]
gcloud billing projects link non-prod-[SUFFIX] --billing-account=[BILLING_ACCOUNT_ID]
gcloud services enable compute.googleapis.com run.googleapis.com container.googleapis.com artifactregistry.googleapis.com firestore.googleapis.com pubsub.googleapis.com aiplatform.googleapis.com cloudaicompanion.googleapis.com apphub.googleapis.com designcenter.googleapis.com discoveryengine.googleapis.com iam.googleapis.com config.googleapis.com cloudbuild.googleapis.com cloudasset.googleapis.com cloudkms.googleapis.com cloudresourcemanager.googleapis.com --project=non-prod-[SUFFIX]
# Check if "development" project exists in Development folder
gcloud projects list --filter="parent.id=[DEVELOPMENT_FOLDER_ID] AND parent.type=folder AND name=development"
# If not present: Create, link billing, and enable APIs
gcloud projects create dev-[SUFFIX] --name="development" --folder=[DEVELOPMENT_FOLDER_ID]
gcloud billing projects link dev-[SUFFIX] --billing-account=[BILLING_ACCOUNT_ID]
gcloud services enable compute.googleapis.com run.googleapis.com container.googleapis.com artifactregistry.googleapis.com firestore.googleapis.com pubsub.googleapis.com aiplatform.googleapis.com cloudaicompanion.googleapis.com apphub.googleapis.com designcenter.googleapis.com discoveryengine.googleapis.com iam.googleapis.com config.googleapis.com cloudbuild.googleapis.com cloudasset.googleapis.com cloudkms.googleapis.com cloudresourcemanager.googleapis.com --project=dev-[SUFFIX]
[!NOTE] Agentic Parallelism Option: While the manual runbook enforces sequential project execution to avoid terminal race conditions, an AI agent with multi-agent orchestration capability may optionally spawn subagents to provision the 4 projects in parallel once folder IDs are resolved.
Configure centralized audit logging and cross-project monitoring scope in the
logging-[SUFFIX] project.
Refer to the Centralized Logging and Monitoring Reference for the detailed step-by-step commands to:
Evaluate the deployment against the following verification checks:
gcloud org-policies list --organization=[ORGANIZATION_ID] and verify all 17 target policies are
enforced or correctly configured.Common, Production,
Non-Production, and Development exist under the organization root.gcloud billing projects list and assert that
all 4 newly created projects are linked to your billing account.[ORG_NAME]-logging
exists in project logging-[SUFFIX], is located in global, and has a
retention period of exactly 30 days.gcloud logging sinks describe at the
organization level and confirm the sink routes cloud audit logs to the
global bucket and holds standard writerIdentity credentials.gcloud beta monitoring metrics-scopes describe and assert that the dev, non-prod, and prod projects appear
in the monitored list of the central logging project.a407c6bf560f