{"id":13643784,"url":"https://github.com/Excoriate/go-terradagger","last_synced_at":"2025-04-21T02:31:40.676Z","repository":{"id":210423375,"uuid":"726103276","full_name":"Excoriate/go-terradagger","owner":"Excoriate","description":"TerraDagger is a Go package for managing your infrastructure-as-code through containers.","archived":false,"fork":false,"pushed_at":"2024-06-12T22:56:33.000Z","size":1152,"stargazers_count":30,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-02T01:21:07.435Z","etag":null,"topics":["cli","devops","ecs","example","sre","tooling"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Excoriate.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-01T14:40:45.000Z","updated_at":"2024-04-02T14:26:41.000Z","dependencies_parsed_at":"2024-04-27T14:20:31.770Z","dependency_job_id":null,"html_url":"https://github.com/Excoriate/go-terradagger","commit_stats":null,"previous_names":["excoriate/go-terradagger"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Fgo-terradagger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Fgo-terradagger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Fgo-terradagger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Fgo-terradagger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Excoriate","download_url":"https://codeload.github.com/Excoriate/go-terradagger/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223846483,"owners_count":17213196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","devops","ecs","example","sre","tooling"],"created_at":"2024-08-02T01:01:52.543Z","updated_at":"2024-11-09T15:32:00.052Z","avatar_url":"https://github.com/Excoriate.png","language":"Go","readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg alt=\"logo\" src=\"docs/logo/terradagger-logo-2.png\" width=\"450px\"/\u003e\u003cbr/\u003e\n  TerraDagger 🗡️\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003eAn easy to understand GO library for building portables CI/CD pipelines (as code) using \u003cb\u003eDagger\u003c/b\u003e for your \u003cb\u003e infrastructure-as-code ☁️\u003c/b\u003e.\u003cbr/\u003e\u003cbr/\u003e\n\n---\n[![Release](https://github.com/Excoriate/go-terradagger/actions/workflows/release.yaml/badge.svg)](https://github.com/Excoriate/go-terradagger/actions/workflows/release.yaml)\n[![Go Build](https://github.com/Excoriate/go-terradagger/actions/workflows/go-build.yml/badge.svg)](https://github.com/Excoriate/go-terradagger/actions/workflows/go-build.yml)\n[![Go Linter](https://github.com/Excoriate/go-terradagger/actions/workflows/go-ci-lint.yaml/badge.svg)](https://github.com/Excoriate/go-terradagger/actions/workflows/go-ci-lint.yaml)\n[![Go Tests](https://github.com/Excoriate/go-terradagger/actions/workflows/go-ci-tests.yml/badge.svg)](https://github.com/Excoriate/go-terradagger/actions/workflows/go-ci-tests.yml)\n\n---\n**TerraDagger** is a **GO library** that provides a set of functions and patterns for building portable CI/CD pipelines (as code) for your infrastructure-as-code. It's based on the wonderful [Dagger](https://dagger.io) pipeline-as-code project, and heavily inspired by [Terratest](https://terratest.gruntwork.io). The problem that TerraDagger tries to solve is to provide a simple way to run your [Terraform](https://www.terraform.io/) code in a portable way, and also to provide a way to run your pipelines in a containerized way, so you can run your pipelines in any environment, and also in any CI/CD platform.\n\n---\n\n## Installation 🛠️\n\nInstall it using [Go get](https://golang.org/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them):\n\n```bash\ngo get github.com/Excoriate/go-terradagger\n```\n\n### Pre-requisites 📋\n\n- [Go](https://golang.org/doc/install) \u003e= 1.18\n- [Docker](https://docs.docker.com/get-docker/) \u003e= 20.10.7\n- [Dagger](https://dagger.io)\n\n\u003e**NOTE**: For the tools used in this project, please check the [Makefile](./Makefile), and the [Taskfile](./Taskfile.yml) files. You'll also need [pre-commit](https://pre-commit.com/) installed.\n\n---\n\n## Features 🎉\n\n- **Portable**: TerraDagger is built to be used in any CI/CD platform, and also in any environment (including your local machine).\n- **Simple**: TerraDagger is built to be simple to use, if you're familiar with [Terratest](https://terratest.gruntwork.io), then you'll find this library very similar.\n- **IAC Support**: Supports [Terraform](https://www.terraform.io/) and [Terragrunt](https://terragrunt.gruntwork.io/).\n\n---\n\n## Getting Started 🚀\n\nConfigure the terradagger client, which under the hood, will configure the Dagger client:\n\n```go\ntd := terradagger.New(ctx, \u0026terradagger.Options{\n  Workspace: viper.GetString(\"workspace\"),\n})\n\n```\n\nNow,\nit's time\nto start the engine\n([Dagger](https://dagger.io)).\nIt's important to start the engine\nbefore running any command, so ensure that your [Docker](https://docs.docker.com/get-docker/) daemon or any compatible [OCI](https://opencontainers.org/) runtime is running.\n\n```go\nif err := td.StartEngine(); err != nil {\n    return err // Handle the error properly in your code.\n}\n\ndefer td.Engine.GetEngine().Close()\n```\n\nTerradagger has global options,\nand also specific [terraform](https://www.terraform.io/) and [terragrunt](https://terragrunt.gruntwork.io/) options.\nyou can set the global options like this:\n\n```go\ntfOptions :=\n   terraformcore.WithOptions(td, \u0026terraformcore.TfOptions{\n     ModulePath:                   viper.GetString(\"module\"),\n     EnableSSHPrivateGit:          true,\n     TerraformVersion:             viper.GetString(\"terraform-version\"),\n     EnvVarsToInjectByKeyFromHost: []string{\"AWS_ACCESS_KEY_ID\", \"AWS_SECRET_ACCESS_KEY\", \"AWS_SESSION_TOKEN\"},\n   })\n\n```\n\nThere are many options supported, options that are meant to facilitate the use of containerized pipelines based on common use-cases, such as:\n\n- Injecting environment variables from the host to the container.\n- Auto-injecting the AWS credentials from the host to the container.\n- Forward your SSH agent to the container, so you can use your SSH keys in the container.\n\nAnd then, you're good to go and run your desired [Terraform](https://www.terraform.io/) commands, and chain them as you wish:\n\n```go\n_, tfInitErr := terraform.InitE(td, tfOptions, terraform.InitOptions{})\nif tfInitErr != nil {\n    return tfInitErr\n}\n\n```\n\n\u003eNOTE: The `E` suffix in the function name means that the specific [terraform](https://www.terraform.io/) command will return the `stdout` and an [error object](https://golang.org/pkg/errors/). The variant without the `E` suffix will return the actual Dagger **Container** object, and an [error object](https://golang.org/pkg/errors/).\n\n\nTo see a full working example, please check the [**terradagger-cli**](cli/) that's built in this repository\n\n---\n\n## Roadmap 🗓️\n\n- [x] Add basic support for Terraform commands (init, validate, plan, apply, destroy, etc).\n- [ ] Add out-of-the-box support for TfLint.\n- [ ] Add extra commands: Validate, Format, and Import.\n- [ ] Add plenty of missing tests 🧪\n- [x] Add support for [Terragrunt](https://terragrunt.gruntwork.io/).\n- [ ] Enrich the [terragrunt](https://terragrunt.gruntwork.io/) API to cover all the commands supported.\n- [ ] Add support for [Terratest](https://terratest.gruntwork.io/).\n- [ ] Add official Docker images for TerraDagger.\n\n\u003e**Note**: This is still work in progress, however, I'll be happy to receive any feedback or contribution. Ensure you've read the [contributing guide](./CONTRIBUTING.md) before doing so.\n\n\n## Contributing\n\nPlease read our [contributing guide](./CONTRIBUTING.md).\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExcoriate%2Fgo-terradagger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FExcoriate%2Fgo-terradagger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExcoriate%2Fgo-terradagger/lists"}