{"id":5379,"library":"pulumi-gcp","title":"Pulumi Google Cloud (GCP) Provider","description":"The `pulumi-gcp` Python package provides a robust interface for defining, deploying, and managing Google Cloud Platform resources using infrastructure-as-code principles. It leverages the Pulumi CLI and Python language to offer programmatic control over GCP services. Currently at version 9.19.0, it is actively maintained with frequent releases that often include updates to align with upstream Terraform provider changes and new GCP features.","status":"active","version":"9.19.0","language":"en","source_language":"en","source_url":"https://github.com/pulumi/pulumi-gcp","tags":["Pulumi","GCP","Google Cloud","Infrastructure as Code","IaC","Cloud Provisioning"],"install":[{"cmd":"pip install pulumi_gcp","lang":"bash","label":"Install with pip"},{"cmd":"pulumi new gcp-python","lang":"bash","label":"Create new Pulumi GCP Python project"}],"dependencies":[{"reason":"Core Pulumi SDK for infrastructure orchestration.","package":"pulumi","optional":false},{"reason":"Required for authentication and underlying GCP interactions, must be installed and authenticated separately.","package":"gcloud CLI","optional":false}],"imports":[{"note":"The Pulumi GCP provider is installed as `pulumi_gcp` and conventionally aliased as `gcp` for brevity and clarity when referencing resources.","wrong":"import gcp","symbol":"gcp","correct":"import pulumi_gcp as gcp"},{"note":"Specific modules for resource types (e.g., `storage`, `compute`, `sql`) are imported from `pulumi_gcp`.","symbol":"storage","correct":"from pulumi_gcp import storage"}],"quickstart":{"code":"import pulumi\nfrom pulumi_gcp import storage\nimport os\n\n# Configure the GCP project ID (replace with your project ID or set via pulumi config)\n# pulumi config set gcp:project my-gcp-project-id\nproject_id = os.environ.get('GCP_PROJECT_ID') or pulumi.Config('gcp').get('project')\n\n# Create a GCP Storage Bucket\n# Note: Bucket names must be globally unique.\nbucket = storage.Bucket(\n    'my-unique-bucket-name',\n    project=project_id, # Ensure project_id is configured or passed\n    location='US-CENTRAL1', # Specify a region or multi-region\n    uniform_bucket_level_access=True # Recommended best practice for security\n)\n\n# Export the bucket's self_link and URL\npulumi.export('bucket_self_link', bucket.self_link)\npulumi.export('bucket_url', bucket.url)","lang":"python","description":"This quickstart program creates a Google Cloud Storage bucket. Before running, ensure you have the Pulumi CLI installed, are authenticated to GCP via `gcloud auth application-default login`, and have run `pulumi new gcp-python` to set up a project. You may need to set the `gcp:project` configuration value using `pulumi config set gcp:project <YOUR_GCP_PROJECT_ID>` or set the `GCP_PROJECT_ID` environment variable."},"warnings":[{"fix":"Review the official 'GCP 9.0 Migration Guide' on the Pulumi Registry. Explicitly set `deletionProtection` where needed. Manually manage `gcp.storage.Bucket` labels post-import. Migrate `gcp.tpu.Node` to `gcp.tpu.V2Vm`. Update resource configurations to comply with new validation rules and format requirements.","message":"Pulumi GCP Provider v9.0.0 introduced several breaking changes. Key changes include: `gcp.alloydb.Cluster` now defaults `deletionProtection` to `true`. The import behavior for `gcp.storage.Bucket` labels changed; labels are no longer directly imported to the `labels` field but appear in `effectiveLabels` and must be explicitly set. `gcp.tpu.Node` was removed in favor of `gcp.tpu.V2Vm`. Several resource fields received increased validation. `gcp.storage.Notification` topic format requires a full resource path.","severity":"breaking","affected_versions":">=9.0.0"},{"fix":"Consult the 'GCP 8.0 Migration Guide'. Explicitly configure `deletionProtection` to `false` if you intend for resources to be destroyable. Adjust `cloudrunv2.Service` port configurations. To opt out of the default label, set `pulumi config set gcp:addPulumiAttributionLabel false`.","message":"Pulumi GCP Provider v8.0.0 introduced changes primarily related to deletion protection and labeling. The `deletionProtection` field was added with a default of `true` for several resources (e.g., `gcp.cloudrunv2.Service`, `gcp.organizations.Project`) to prevent accidental deletion. The `template.containers[].ports` field in `gcp.cloudrunv2.Service` changed from a list to an object type. A new default provisioning label `goog-pulumi-provisioned` is now added to all resources, appearing in `pulumiLabels` and `effectiveLabels` outputs.","severity":"breaking","affected_versions":">=8.0.0 <9.0.0"},{"fix":"Refer to the 'GCP 7.0 Migration Guide'. Understand the new label semantics: if you rely on all GCP-managed labels appearing in your Pulumi state, you now need to inspect `effectiveLabels`. While direct label changes often don't require code modification for Python, be aware of the new output fields and their impact on diffs.","message":"Pulumi GCP Provider v7.0.0 introduced a significant rework of label handling. The `labels` field became non-authoritative, managing only the labels defined in your Pulumi configuration. New output-only fields `pulumiLabels` (merges config labels with global defaults) and `effectiveLabels` (all labels on the GCP resource) were added. This can lead to unexpected diffs on upgrade, but these are typically safe 'output-only' changes.","severity":"breaking","affected_versions":">=7.0.0 <8.0.0"},{"fix":"Ensure `gcloud CLI` is installed and updated. Run `gcloud auth application-default login` to authenticate. Set the target GCP project using `pulumi config set gcp:project <YOUR_PROJECT_ID>` or by providing it as an argument to resources where applicable.","message":"The Pulumi GCP provider relies on the Google Cloud SDK (`gcloud CLI`) being installed and authenticated on the machine where Pulumi commands are run. Lack of proper authentication (e.g., `gcloud auth application-default login`) or incorrect project configuration can lead to authentication errors or resources being deployed to an unintended project.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check the Pulumi GCP GitHub Issues for known bugs or 'awaiting-upstream' issues that match your symptoms. Consult migration guides for recent major versions, as 'spurious diffs' fixes are often implemented. If a resource perpetually updates, inspect the `pulumi preview --diff` output carefully to understand the exact difference Pulumi perceives. Sometimes, refreshing the state (`pulumi refresh`) can resolve minor inconsistencies.","message":"Unexpected resource recreation or 'perpetual diffs' can occur, especially after provider updates or due to subtle API changes in GCP's underlying services. This can result in `pulumi up` always showing changes even if the user's code has not changed.","severity":"gotcha","affected_versions":"All versions (may be more frequent with major provider updates)"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}