{"id":8201,"library":"google-cloud-parametermanager","title":"Google Cloud Parametermanager","description":"google-cloud-parametermanager is the Python client library for the Google Cloud Parametermanager API. This service, an extension to Secret Manager, provides a centralized and secure store for application configuration parameters such as environment variables, feature flags, and API keys. It offers features like data encryption, versioning, support for structured formats (YAML, JSON), and fine-grained Identity and Access Management (IAM) controls. The current version is 0.4.0, and as part of the `google-cloud-python` monorepo, its sub-libraries receive frequent updates.","status":"active","version":"0.4.0","language":"en","source_language":"en","source_url":"https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-parametermanager","tags":["google cloud","parametermanager","gcp","configuration management","secrets management"],"install":[{"cmd":"pip install google-cloud-parametermanager","lang":"bash","label":"Install latest stable version"}],"dependencies":[{"reason":"Required Python version.","package":"python","optional":false}],"imports":[{"note":"Google Cloud client libraries often use a versioned import path (e.g., _v1) for their main client classes.","wrong":"from google.cloud.parametermanager import ParameterManagerServiceClient","symbol":"ParameterManagerServiceClient","correct":"from google.cloud.parametermanager_v1 import ParameterManagerServiceClient"}],"quickstart":{"code":"import os\nfrom google.cloud.parametermanager_v1 import ParameterManagerServiceClient\n\ndef quickstart_parametermanager(project_id: str):\n    \"\"\"\n    Initializes the Parameter Manager client and lists parameters in a project.\n    Requires GOOGLE_APPLICATION_CREDENTIALS to be set or ADC to be configured.\n    \"\"\"\n    if not project_id or project_id == \"your-gcp-project-id\":\n        print(\"Please provide a valid Google Cloud Project ID.\")\n        print(\"Set the GOOGLE_CLOUD_PROJECT environment variable or update the project_id variable.\")\n        return\n\n    client = ParameterManagerServiceClient()\n    # The parent format is projects/{project_id}/locations/{location}\n    # 'global' is a common location for many Parameter Manager operations.\n    parent = f\"projects/{project_id}/locations/global\"\n\n    try:\n        print(f\"Listing parameters in project {project_id} (location: global)...\")\n        # List all parameters in the specified project and location\n        for parameter in client.list_parameters(parent=parent):\n            print(f\"  Parameter Name: {parameter.name}\")\n            print(f\"    Format: {parameter.format.name}\")\n            print(f\"    Create Time: {parameter.create_time}\")\n            if parameter.labels:\n                print(f\"    Labels: {parameter.labels}\")\n            print(\"---\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Ensure the Parameter Manager API is enabled for your project and your credentials have 'roles/parametermanager.viewer' or similar permissions.\")\n\nif __name__ == \"__main__\":\n    # Replace 'your-gcp-project-id' with your actual Google Cloud Project ID.\n    # For local development, ensure Application Default Credentials are set up:\n    # 1. `gcloud auth application-default login`\n    # 2. Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your service account key file path.\n    project_id = os.environ.get(\"GOOGLE_CLOUD_PROJECT\", \"your-gcp-project-id\")\n    quickstart_parametermanager(project_id)\n","lang":"python","description":"This quickstart initializes the Parameter Manager client and lists all parameters configured within a specified Google Cloud project and the 'global' location. It demonstrates basic client instantiation and interaction, highlighting the importance of setting the project ID and having appropriate IAM permissions. Ensure Application Default Credentials (ADC) are configured for authentication."},"warnings":[{"fix":"Always pin the exact version (`pip install google-cloud-parametermanager==X.Y.Z`) in production. Regularly review release notes and test against new versions before deploying.","message":"The `google-cloud-parametermanager` library is currently in 'Public Preview' status. This means it is under active development, and any release is subject to backwards-incompatible changes at any time. Features, API surfaces, and behavior may change without extensive deprecation periods.","severity":"breaking","affected_versions":"0.x.x (all preview versions)"},{"fix":"Ensure the principal has the necessary roles (e.g., `roles/parametermanager.viewer` for reading, `roles/parametermanager.editor` for creating/updating, `roles/parametermanager.admin` for full control) on the project or specific parameter resources. For referencing Secret Manager secrets, the Parameter Manager service identity must also have `Secret Manager Secret Accessor` permission on the referenced secrets.","message":"Improper IAM permissions for the service account or user account used to access the Parameter Manager API will result in `PermissionDenied` errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For local development, use `gcloud auth application-default login` or set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of a service account key file. For deployed applications, leverage managed identities like service accounts on Compute Engine, Cloud Run, GKE, etc., with appropriate IAM roles.","message":"Authentication to Google Cloud APIs, including Parameter Manager, relies on Application Default Credentials (ADC). Misconfiguration of ADC often leads to authentication errors or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Grant the appropriate IAM role, such as `roles/parametermanager.viewer` (for reading) or `roles/parametermanager.editor` (for modifying), to the principal on the Google Cloud project or specific Parameter Manager resource.","cause":"The authenticated principal (user or service account) lacks the necessary IAM permissions to perform the requested operation on the Parameter Manager resource.","error":"google.api_core.exceptions.PermissionDenied: 403 Permission 'parametermanager.parameters.list' denied for resource..."},{"fix":"Install the library using `pip install google-cloud-parametermanager`. Ensure the import statement correctly uses the versioned path: `from google.cloud.parametermanager_v1 import ParameterManagerServiceClient`.","cause":"The `google-cloud-parametermanager` library is not installed, or the import path is incorrect, often missing the version suffix.","error":"ModuleNotFoundError: No module named 'google.cloud.parametermanager'"},{"fix":"Construct the full resource name string correctly, including the project ID, location, and parameter ID, and pass it to the relevant client method's `name` argument.","cause":"Methods expecting a parameter resource name (e.g., `get_parameter`, `delete_parameter`) were called without providing the full resource name in the format `projects/{project_id}/locations/{location}/parameters/{parameter_id}`.","error":"ValueError: A parameter name must be provided to the API."}]}