{"id":23407,"library":"cdktf-cdktf-provider-google","title":"CDKTF Google Provider","description":"CDKTF (CDK for Terraform) prebuilt bindings for the Google Cloud Platform (GCP) provider. Version 16.12.1 targets Terraform provider google ~> 6.0. Released frequently, follows cdktf provider releases.","status":"active","version":"16.12.1","language":"python","source_language":"en","source_url":"https://github.com/cdktf/cdktf-provider-google","tags":["cdktf","terraform","google-cloud","gcp","infrastructure-as-code"],"install":[{"cmd":"pip install cdktf-cdktf-provider-google","lang":"bash","label":"Standard install"}],"dependencies":[{"reason":"Required to construct and deploy stacks using this provider.","package":"cdktf","optional":false},{"reason":"Base library for CDKTF constructs.","package":"constructs","optional":false}],"imports":[{"note":"The provider is imported as a module named 'google', not the pypi package name.","wrong":"import cdktf_cdktf_provider_google","symbol":"google","correct":"from cdktf_cdktf_provider_google import google"},{"note":"Resources are in submodules; direct import fails.","wrong":"from cdktf_cdktf_provider_google import ComputeInstance","symbol":"ComputeInstance","correct":"from cdktf_cdktf_provider_google.compute_instance import ComputeInstance"},{"note":"Data sources also in submodules.","wrong":"from cdktf_cdktf_provider_google import DataGoogleComputeInstance","symbol":"DataGoogleComputeInstance","correct":"from cdktf_cdktf_provider_google.data_google_compute_instance import DataGoogleComputeInstance"}],"quickstart":{"code":"from cdktf import App, TerraformStack\nfrom cdktf_cdktf_provider_google import google\nfrom cdktf_cdktf_provider_google.compute_instance import ComputeInstance\n\napp = App()\nstack = TerraformStack(app, \"quickstart\")\ngoogle.GoogleProvider(stack, \"provider\", project=\"my-project\", region=\"us-central1\")\nComputeInstance(stack, \"vm\", name=\"test\", machine_type=\"e2-micro\", zone=\"us-central1-a\", boot_disk={\"initialize_params\": {\"image\": \"debian-cloud/debian-11\"}}, network_interface=[{\"network\": \"default\"}])\napp.synth()","lang":"python","description":"Minimal stack creating a GCE instance and synthesizing Terraform JSON."},"warnings":[{"fix":"Upgrade to Python 3.9+.","message":"Version 16.x drops support for Python 3.8 (requires ~=3.9).","severity":"breaking","affected_versions":">=16.0.0"},{"fix":"Check upstream Terraform google provider changelog and update resource configs accordingly.","message":"Breaking changes between major provider versions (e.g., from 5.x to 6.x) reflect upstream Terraform provider changes. Always pin provider version and run `cdktf diff` after upgrades.","severity":"breaking","affected_versions":"All versions"},{"fix":"Use snake_case for all resource properties. Refer to CDKTF documentation for bindings.","message":"Property names use snake_case in Python, not camelCase as in HCL. Common mistake: `machineType` instead of `machine_type`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always provide `id` argument: `Resource(stack, 'id', ...)`.","message":"Resource constructor expects `id` as second positional argument (the construct ID). Omitting it or reordering arguments causes cryptic errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install cdktf-cdktf-provider-google` and import as `from cdktf_cdktf_provider_google import google`.","cause":"Package not installed or imported incorrectly.","error":"ModuleNotFoundError: No module named 'cdktf_cdktf_provider_google'"},{"fix":"Import from submodule: `from cdktf_cdktf_provider_google.compute_instance import ComputeInstance`.","cause":"Direct import of resource without submodule.","error":"AttributeError: module 'cdktf_cdktf_provider_google' has no attribute 'ComputeInstance'"},{"fix":"Ensure the second argument is the construct ID string. Example: `ComputeInstance(stack, 'my_instance', ...)`.","cause":"Missing or wrong number of positional arguments; often missing construct `id`.","error":"TypeError: __init__() takes at least 4 arguments (3 given)"},{"fix":"Replace `machineType` with `machine_type` (and similarly for all properties).","cause":"Using camelCase property name instead of snake_case.","error":"Error: Unsupported attribute: \"machineType\""},{"fix":"Add GoogleProvider to stack with required fields: `google.GoogleProvider(stack, 'google', project='...')`.","cause":"GoogleProvider not configured properly.","error":"Error: Invalid provider configuration\n  on main.tf.json line X: provider.google: missing required field 'project'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}