Documentation
Plugins
Sources
Terraform
Overview

Terraform Source Plugin

Latest: v3.0.10

The CloudQuery Terraform plugin extracts terraform state and loads it into any supported CloudQuery destination (e.g. PostgreSQL, BigQuery, Snowflake, and more).

Configuration

kind: source
spec:
  # Source spec section
  name: terraform
  path: cloudquery/terraform
  version: "v3.0.10"
  tables: ["*"]
  destinations: ["postgresql"]
  spec:
    backends:
      - name: local
        type: local
        config:
          path: /tmp/cloudquery
      - name: s3
        type: s3
        config:
          bucket: <bucket>
          key: <key>
          region: <region>
          role_arn: <role_arn>

You can have multiple backends at the same time, by describing them in the configuration. Every configuration block describes one backend to handle. CloudQuery currently supports local and s3 backends.

Authentication for S3 backends

To authenticate CloudQuery with your Terraform state in S3 you can use any of the following options (see full documentation at AWS SDK V2 (opens in a new tab)):

  • Static Credentials: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
  • Shared configuration files (via aws configure).
  • SDK defaults to credentials file under .aws folder that is placed in the home folder on your computer
  • SDK defaults to config file under .aws folder that is placed in the home folder on your computer
  • If your application uses an ECS task definition or RunTask API operation, IAM role for tasks
  • If your application is running on an Amazon EC2 instance, IAM role for Amazon EC2

Terraform Spec

This is the (nested) spec used by the Terraform source plugin:

  • concurrency (int, optional, default: 10000): A best effort maximum number of Go routines to use. Lower this number to reduce memory usage.