Export from Terraform to Google Cloud Storage
CloudQuery is an open-source data integration platform that allows you to export data from any source to any destination.
The CloudQuery Terraform plugin allows you to sync data from Terraform to any destination, including Google Cloud Storage. It takes only minutes to get started.
Terraform
The CloudQuery Terraform plugin extracts terraform state and loads it into any supported CloudQuery destination
cloudquery
v4.6.6
Source
Google Cloud Storage
This destination plugin lets you sync data from a CloudQuery source to remote GCS (Google Cloud Storage) storage in various formats such as CSV, JSON and Parquet
Table of Contents
MacOS Setup
Step 1. Install CloudQuery
brew install cloudquery/tap/cloudquery
Step 2. Log in to CloudQuery CLI
cloudquery login
Step 3. Configure Terraform source plugin
You can find more information about the configuration in the plugin documentation
kind: source
spec:
# Source spec section
name: terraform
path: cloudquery/terraform
registry: cloudquery
version: "v4.6.6"
tables: ["*"]
destinations: ["v5.2.2"]
spec:
backends:
- name: local
type: local
config:
prefix: /tmp/cloudquery
- name: s3
type: s3
config:
bucket: <bucket>
prefix: <prefix>
region: <region>
role_arn: <role_arn>
Step 4. Configure Google Cloud Storage destination plugin
You can find more information about the configuration in the plugin documentation
kind: destination
spec:
name: "gcs"
path: "cloudquery/gcs"
registry: "cloudquery"
version: "v5.2.2"
write_mode: "append"
spec:
bucket: "bucket_name"
path: "path/to/files/{{TABLE}}/{{UUID}}.{{FORMAT}}"
format: "parquet" # options: parquet, json, csv
format_spec:
# CSV specific parameters:
# delimiter: ","
# skip_header: false
# Parquet specific parameters:
# version: "v2Latest"
# root_repetition: "repeated"
# Optional parameters
# compression: "" # options: gzip
# no_rotate: false
# batch_size: 10000
# batch_size_bytes: 52428800 # 50 MiB
# batch_timeout: 30s
Step 5. Run Sync
cloudquery sync terraform.yml gcs.yml