This is a lightweight Bash script that imports existing Google Cloud Platform (GCP) resources into a Terraform state file. For some services it will also generate the Terraform code.
The script imports resources for the following GCP services:
- API Services
- Service Accounts [+ code]
- BigQuery Datasets [+ code]
- Cloud Storage Buckets
To use this script, the following tools must be installed and configured:
- Run
gcloud init
- (Then for Terraform)
gcloud auth application-default login
./importer.sh <project_id>
Note:
This script is intended to be used as a starting point for importing existing GCP resources into Terraform. It may need to be modified to fit your specific use case.