Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Summary

<!-- What does this PR do? One paragraph or bullet list. -->

## Type of change

- [ ] Bug fix
- [ ] New feature / resource support
- [ ] Refactoring (no behavior change)
- [ ] Documentation
- [ ] CI / tooling

## Schema changes

- [ ] This PR modifies the YAML schema — `schemas/v1.json` and `docs/configuration/yaml-schema.md` updated
- [ ] No schema changes

## Checklist

- [ ] `make fmt` passes
- [ ] `make test` passes
- [ ] `make lint` passes
- [ ] `CHANGELOG.md` updated under `[Unreleased]`
- [ ] Docs updated if behavior changed
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: CI

on:
pull_request:
paths:
- "**.tf"
- "tests/**"
- "schemas/**"
- ".github/workflows/ci.yml"
push:
branches: [main]
paths:
- "**.tf"
- "tests/**"
- "schemas/**"

jobs:
validate:
name: Validate
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: hashicorp/setup-terraform@v3
with:
terraform_version_file: .terraform-version

- name: Cache Terraform providers
uses: actions/cache@v4
with:
path: .terraform
key: terraform-${{ hashFiles('.terraform.lock.hcl') }}
restore-keys: terraform-

- name: Format check
run: terraform fmt -check -recursive

- name: Init
run: terraform init -backend=false

- name: Set up tflint
uses: terraform-linters/setup-tflint@v4
with:
tflint_version: latest

- name: Lint
run: |
tflint --init
tflint --recursive

- name: Test (mock providers)
run: terraform test
50 changes: 50 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# integration.yml — runs Go/Terratest integration tests against a real dbt Cloud account.
# Triggered manually only to avoid consuming sandbox API quota on every PR.
# Requires secrets: DBT_CLOUD_ACCOUNT_ID, DBT_CLOUD_TOKEN

name: Integration Tests

on:
workflow_dispatch:
inputs:
host_url:
description: "dbt Cloud host URL (leave blank for https://cloud.getdbt.com)"
required: false
default: ""

permissions:
contents: read

jobs:
integration:
name: Integration Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
cache-dependency-path: test/go.sum

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version_file: .terraform-version
terraform_wrapper: false

- name: Go mod download
working-directory: test
run: go mod download

- name: Run integration tests
working-directory: test
env:
RUN_INTEGRATION_TESTS: "1"
DBT_CLOUD_ACCOUNT_ID: ${{ secrets.DBT_CLOUD_ACCOUNT_ID }}
DBT_CLOUD_TOKEN: ${{ secrets.DBT_CLOUD_TOKEN }}
DBT_CLOUD_HOST_URL: ${{ github.event.inputs.host_url }}
run: go test -v -timeout 30m -run Integration ./...
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# release.yml — triggered by a version tag (e.g. git tag v1.2.3 && git push --tags).
#
# Produces two release assets:
# starter.tar.gz — the examples/basic/ directory, ready to extract
# install.sh — bootstrap script that downloads starter.tar.gz

name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Package starter
run: tar -czf starter.tar.gz -C examples/basic .

- name: Create release with assets
uses: softprops/action-gh-release@v2
with:
files: |
install.sh
starter.tar.gz
generate_release_notes: true
61 changes: 61 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# test.yml — runs Terraform unit tests on every pull request and push to main.
# Uses mock providers so no dbt Cloud credentials are required.

name: Test

on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
root-tests:
name: Root Module Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version_file: .terraform-version

- name: Terraform Init
run: terraform init -backend=false

- name: Terraform Test
run: terraform test -verbose

module-tests:
name: Module Tests (${{ matrix.module }})
runs-on: ubuntu-latest
strategy:
matrix:
module:
- project
- environments
- jobs
- credentials
- repository

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version_file: .terraform-version

- name: Terraform Init
working-directory: modules/${{ matrix.module }}
run: terraform init -backend=false

- name: Terraform Test
working-directory: modules/${{ matrix.module }}
run: terraform test -verbose
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc

*.DS_Store
1 change: 1 addition & 0 deletions .terraform-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.14.8
56 changes: 20 additions & 36 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .terraformrc.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Terraform CLI config for running tests locally.
# Removes the dev_overrides that point to a local provider build,
# allowing terraform test to use the provider from .terraform/providers/.
#
# Usage:
# TF_CLI_CONFIG_FILE=.terraformrc.test terraform test
# TF_CLI_CONFIG_FILE=/path/to/repo/.terraformrc.test terraform -chdir=modules/project test

provider_installation {
filesystem_mirror {
path = "/Users/tylerrouze/dev/terraform-dbtcloud-yaml/.terraform/providers"
include = ["registry.terraform.io/dbt-labs/dbtcloud"]
}
direct {
exclude = ["registry.terraform.io/dbt-labs/dbtcloud"]
}
}
14 changes: 10 additions & 4 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
plugin "aws" {
enabled = false
}

rule "terraform_required_version" {
enabled = true
}
Expand All @@ -21,6 +17,12 @@ rule "terraform_documented_outputs" {
rule "terraform_naming_convention" {
enabled = true
format = "snake_case"

# Allow a leading underscore for locals — used as a convention for
# "private" intermediate locals in validation.tf.
locals {
custom = "^_?[a-z][a-z0-9_]*$"
}
}

rule "terraform_comment_syntax" {
Expand All @@ -38,3 +40,7 @@ rule "terraform_unused_required_providers" {
rule "terraform_standard_module_structure" {
enabled = true
}

rule "terraform_module_pinned_source" {
enabled = false
}
Loading
Loading