{"id":25021000,"url":"https://github.com/excoriate/tftest","last_synced_at":"2025-08-01T05:38:07.433Z","repository":{"id":228030600,"uuid":"772947107","full_name":"Excoriate/tftest","owner":"Excoriate","description":"A collection of commonly use functions for terratest 🧪 \u0026 terraform 🏗️","archived":false,"fork":false,"pushed_at":"2024-05-31T10:36:02.000Z","size":294,"stargazers_count":4,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-10T10:51:39.065Z","etag":null,"topics":[],"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":"2024-03-16T10:14:42.000Z","updated_at":"2024-05-31T10:35:58.000Z","dependencies_parsed_at":"2024-03-16T14:29:25.621Z","dependency_job_id":"19772386-91d5-42bd-bcd4-5ce48b88cab7","html_url":"https://github.com/Excoriate/tftest","commit_stats":null,"previous_names":["excoriate/tftest"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Ftftest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Ftftest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Ftftest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Excoriate%2Ftftest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Excoriate","download_url":"https://codeload.github.com/Excoriate/tftest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665782,"owners_count":21142122,"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":[],"created_at":"2025-02-05T12:18:37.192Z","updated_at":"2025-04-13T04:41:01.707Z","avatar_url":"https://github.com/Excoriate.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg alt=\"logo\" src=\"img/tftest-logo.png\" width=\"300px\"/\u003e\u003cbr/\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003eA collection of functions and common patterns to test \u003ca href=\"https://www.terraform.io/\"\u003eTerraform\u003c/a\u003e code using \u003ca href=\"https://golang.org/\"\u003eGo\u003c/a\u003e, and \u003ca href=\"https://terratest.gruntwork.io\"\u003eTerratest\u003c/a\u003e.\u003cbr/\u003e\u003cbr/\u003e\n\n\n---\n\n## Why 🤔\n\nThis library wraps Terratest to provide simplified functions for common testing patterns in Terraform modules.\nThe **problem** that this library aims to solve is to make it so easy to write\n([terraform](https://www.terraform.io/)) tests that you don't need to be a profficient Go developer to write them.\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/tftest\n```\n\n### Pre-requisites 📋\n\n- [Go](https://golang.org/doc/install) \u003e= 1.18\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\n## Usage 🚀\n\n### Simple 'Plan' scenario\n\n```go\npackage simple\n\nimport (\n    \"testing\"\n    \"github.com/stretchr/testify/assert\"\n    \"github.com/excoriate/tftest/pkg/scenario\"\n)\n\nfunc TestSimpleOptionsPlanScenario(t *testing.T) {\n    s, err := scenario.New(t, \"../../data/tf-random\")\n    assert.NoErrorf(t, err, \"Failed to create scenario: %s\", err)\n\n    s.Stg.PlanStage(t, s.GetTerraformOptions())\n}\n\n```\n\n### Expecting changes on plan time for certain resources\n\n```go\n\nimport (\n\"testing\"\n\"github.com/stretchr/testify/assert\"\n\"github.com/excoriate/tftest/pkg/scenario\"\n)\n\n\nfunc TestSpecificResourcesExpectedChanges(t *testing.T) {\n    s, err := scenario.New(t, \"../../data/tf-random\")\n    assert.NoErrorf(t, err, \"Failed to create scenario: %s\", err)\n\n    s.Stg.PlanWithSpecificResourcesThatWillChange(t, s.GetTerraformOptions(), []string{\"random_id.this\"})\n}\n\n```\n\n### Full lifecycle (init, plan, destroy) scenario\n\n```go\nimport (\n\"testing\"\n\"github.com/stretchr/testify/assert\"\n\"github.com/excoriate/tftest/pkg/scenario\"\n)\n\nfunc TestLifecycle(t *testing.T) {\n    s, err := scenario.New(t, \"../../data/tf-random\")\n    assert.NoErrorf(t, err, \"Failed to create scenario: %s\", err)\n\n    defer s.Stg.DestroyStage(t, s.GetTerraformOptions())\n\n    s.Stg.PlanStageWithAnySortOfChanges(t, s.GetTerraformOptions())\n    s.Stg.ApplyStage(t, s.GetTerraformOptions())\n}\n```\n\n### Expecting a variable that should have an expected value on Plan time\n\n```go\nimport (\n\"testing\"\n\"github.com/stretchr/testify/assert\"\n\"github.com/excoriate/tftest/pkg/scenario\"\n)\n\nfunc TestWithVarOptionsValid(t *testing.T) {\n\tworkdir := \"../../data/tf-random\"\n\ts, err := scenario.NewWithOptions(t, workdir,\n\t\tscenario.WithVarFiles(workdir, \"fixtures/override-random-password.tfvars\"))\n\n\tassert.NoErrorf(t, err, \"Failed to create scenario: %s\", err)\n\n\ts.Stg.PlanWithSpecificVariableValueToExpect(t, s.GetTerraformOptions(), \"random_length_password\", \"25\")\n}\n\n```\n\nMore examples will be added in the [examples](./test/examples) folder.\n\n---\n\n## APIs 📚\n\nThere are more API(s) available for the following common patterns:\n\n- [x] A strict validation of the **terraform directory** (it validates whether it's an actual terraform module, directory integrity and others).\n- [x] A strict validation of `terraform.tfvars` files.\n- [x] Cloud Provider API(s). Currently, [AWS](https://aws.amazon.com/) is supported.\n\n\n## Roadmap 🗓️\n\n- [ ] Add more tests\n- [ ] Add a set of pre-defined error messages\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcoriate%2Ftftest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexcoriate%2Ftftest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexcoriate%2Ftftest/lists"}