Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fluent-ci-templates/terraform-pipeline
A ready-to-use CI/CD Pipeline for managing your infrastructure with Terraform.
https://github.com/fluent-ci-templates/terraform-pipeline
cicd dagger deno pipeline terraform typescript
Last synced: about 6 hours ago
JSON representation
A ready-to-use CI/CD Pipeline for managing your infrastructure with Terraform.
- Host: GitHub
- URL: https://github.com/fluent-ci-templates/terraform-pipeline
- Owner: fluent-ci-templates
- License: mit
- Created: 2023-08-07T08:38:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-18T15:36:48.000Z (5 months ago)
- Last Synced: 2024-07-24T01:02:32.399Z (4 months ago)
- Topics: cicd, dagger, deno, pipeline, terraform, typescript
- Language: TypeScript
- Homepage:
- Size: 184 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Terraform Pipeline
[![fluentci pipeline](https://shield.fluentci.io/x/terraform_pipeline)](https://pkg.fluentci.io/terraform_pipeline)
![deno compatibility](https://shield.deno.dev/deno/^1.41)
[![dagger-min-version](https://shield.fluentci.io/dagger/v0.11.7)](https://dagger.io)
[![](https://jsr.io/badges/@fluentci/terraform)](https://jsr.io/@fluentci/terraform)
[![ci](https://github.com/fluent-ci-templates/terraform-pipeline/actions/workflows/ci.yml/badge.svg)](https://github.com/fluent-ci-templates/terraform-pipeline/actions/workflows/ci.yml)A ready-to-use CI/CD Pipeline for managing your infrastructure with [Terraform](https://www.terraform.io/).
## 🚀 Usage
Run the following command in your project:
```bash
fluentci run terraform_pipeline
```Or, if you want to use it as a template:
```bash
fluentci init -t terraform
```This will create a `.fluentci` folder in your project.
Now you can run the pipeline with:
```bash
fluentci run .
```## 🧩 Dagger Module
Use as a [Dagger](https://dagger.io) module:
```bash
dagger install github.com/fluent-ci-templates/terraform-pipeline@main
```Call functions from the module:
```bash
dagger call init --src . \
--google-application-credentials /path/to/credentials.jsondagger call validate --src .
dagger call plan --src . \
--google-application-credentials /path/to/credentials.jsondagger call apply --src . \
--google-application-credentials /path/to/credentials.json
```## 🛠️ Environment variables
| Variable | Description |
| --------------------------- | -------------------------------------------------- |
| TF_VERSION | The Terraform version to use. Defaults to `latest` |
| TF_CLOUD_ORGANIZATION | The Terraform Cloud organization to use |
| TF_API_TOKEN | The Terraform Cloud API token |
| TF_WORKSPACE | The Terraform Cloud workspace to use |
| TF_LOG | The Terraform log level |
| TF_LOG_PATH | The Terraform log path |
| TF_INPUT | Whether to ask for input |
| TF_VAR_* | Terraform variables |
| TF_CLI_ARGS | Additional Terraform CLI arguments |
| TF_CLI_ARGS_* | Additional Terraform CLI arguments |
| TF_DATA_DIR | The Terraform data directory |
| TF_WORKSPACE | The Terraform workspace |
| TF_IN_AUTOMATION | Whether Terraform is running in CI |
| TF_REGISTRY_DISCOVERY_RETRY | Whether to enable registry discovery |
| TF_REGISTRY_CLIENT_TIMEOUT | The registry client timeout |
| TF_CLI_CONFIG_FILE | The Terraform CLI config file |
| TF_PLUGIN_CACHE_DIR | The Terraform plugin cache directory |
| TF_IGNORE | Display ignored files and directories |## ✨ Jobs
| Job | Description |
| --------- | -------------------------------------- |
| init | Initialize Terraform working directory |
| validate | Validate the configuration files |
| plan | Generate and show an execution plan |
| apply | Builds or changes infrastructure |```typescript
init(
src: Directory | string | undefined = ".",
tfVersion?: string,
googleApplicationCredentials?: string
): Promisevalidate(
src: Directory | string = ".",
tfVersion?: string
): Promiseplan(
src: Directory | string = ".",
tfVersion?: string,
googleApplicationCredentials?: string
): Promiseapply(
src: Directory | string = ".",
tfVersion?: string,
googleApplicationCredentials?: string
): Promise
```## 👨💻 Programmatic usage
You can also use this pipeline programmatically:
```ts
import { init, validate, plan, apply } from "jsr:@fluentci/terraform";await init();
await validate();
await plan();
// await apply();```