{"id":18636682,"url":"https://github.com/localstack/localstack-terraform-test","last_synced_at":"2025-04-11T09:31:01.481Z","repository":{"id":41394609,"uuid":"373433469","full_name":"localstack/localstack-terraform-test","owner":"localstack","description":"Utilities to run Terraform tests against LocalStack","archived":false,"fork":false,"pushed_at":"2024-04-10T07:23:23.000Z","size":157,"stargazers_count":24,"open_issues_count":3,"forks_count":6,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-04-10T08:30:07.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-06-03T08:22:00.000Z","updated_at":"2024-04-15T11:29:28.799Z","dependencies_parsed_at":"2023-10-03T14:05:19.061Z","dependency_job_id":"3e17be31-e9f4-43c4-aef4-1a63d5880dfd","html_url":"https://github.com/localstack/localstack-terraform-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flocalstack-terraform-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flocalstack-terraform-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flocalstack-terraform-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Flocalstack-terraform-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack","download_url":"https://codeload.github.com/localstack/localstack-terraform-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248368207,"owners_count":21092317,"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":"2024-11-07T05:31:10.386Z","updated_at":"2025-04-11T09:31:01.473Z","avatar_url":"https://github.com/localstack.png","language":"Python","readme":"## 📖 Table of Contents\n1. [🌍 Localstack Terraform Test Runner 🚀](#-localstack-terraform-test-runner-)\n2. [🎯 Purpose](#-purpose)\n3. [🔧 Installation](#-installation)\n4. [🏃‍ How to Run](#-how-to-run)\n5. [🔍 How to Run Test Cases](#-how-to-run-test-cases)\n6. [🔢 Default Environment Variables for Terraform Tests](#-default-environment-variables-for-terraform-tests)\n7. [⚙️ Options](#-options)\n8. [🔐 Services](#-services)\n\n---\n\n## 🌍 **Localstack Terraform Test Runner** 🚀\n\nThis utility serves as a test runner designed specifically for Localstack and Terraform. By leveraging it, users can execute test cases from the Hashicorp Terraform provider AWS against a Localstack Instance.\n\n## 🎯 **Purpose**\n\nThe primary objective behind this project is to segregate test cases from the Localstack repo and execute them against Localstack. This helps in obtaining parity metrics.\n\n---\n\n## 🔧 **Installation**\n\n1. 📦 Clone the repository (including submodules):\n```\ngit clone git@github.com:localstack/localstack-terraform-test.git --recurse-submodules\n```\n\n2. 🔀 Ensure you're on the latest version of the submodules:\n```\ngit submodule update --init --recursive\n```\n\n3. 🚀 Install dependencies:\n```\nmake install\n```\n\n---\n\n## 🏃‍♂️ **How to Run**\n\n- 🔑 (Pro-image only) Set the `LOCALSTACK_AUTH_TOKEN` environment variable.\n- Apply the patch to the Terraform provider AWS:\n```\npython -m terraform_pytest.main patch\n```\n⚠️ _Note: The above operation isn't idempotent. Ensure you apply the patch only once._\n\n- Construct a testing binary for the Golang module:\n```\npython -m terraform_pytest.main build -s s3\n```\n- Now you're all set to utilize the `python -m pytest` commands to list and execute test cases derived from Golang.\n\n---\n\n## 🔍 **How to Run Test Cases**\n\n- 📋 List all test cases from a specific service:\n```\npython -m pytest terraform-provider-aws/internal/service/\u003cservice\u003e --collect-only -q\n```\n- 🚀 Execute a particular test case:\n```\npython -m pytest terraform-provider-aws/internal/service/\u003cservice\u003e/\u003ctest-file\u003e -k \u003ctest-case-name\u003e --ls-start\n```\n_or_\n```\npython -m pytest terraform-provider-aws/internal/service/\u003cservice\u003e/\u003ctest-file\u003e::\u003ctest-case-name\u003e --ls-start\n```\n- You can prepend additional environment variables to the command. For instance:\n```\nAWS_ALTERNATE_REGION='us-west-2' python -m pytest terraform-provider-aws/internal/service/\u003cservice\u003e/\u003ctest-file\u003e::\u003ctest-case-name\u003e --ls-start\n```\n\n---\n\n## 🔢 **Default Environment Variables for Terraform Tests**\n\n| Variable                             | Default Value |\n|--------------------------------------|---------------|\n| `TF_ACC`                             | 1             |\n| `AWS_ACCESS_KEY_ID`                  | test          |\n| `AWS_SECRET_ACCESS_KEY`              | test          |\n| `AWS_DEFAULT_REGION`                 | us-west-1     |\n| `AWS_ALTERNATE_ACCESS_KEY_ID`        | test          |\n| `AWS_ALTERNATE_SECRET_ACCESS_KEY`    | test          |\n| `AWS_ALTERNATE_REGION`               | us-east-2     |\n| `AWS_THIRD_SECRET_ACCESS_KEY`        | test          |\n| `AWS_THIRD_ACCESS_KEY_ID`            | test          |\n| `AWS_THIRD_REGION`                   | eu-west-1     |\n\n---\n\n## ⚙️ **Options**\n\n- `--ls-start`: Initializes the Localstack instance before test case execution. It triggers the CLI:\n```\nlocalstack start -d\n```\n\n- `--gather-metrics`: Gathers raw test metrics for a specific run. But first, make sure you manually install the extension:\n```\nlocalstack extensions init\nlocalstack extensions install \"git+https://github.com/localstack/localstack-moto-test-coverage/#egg=collect-raw-metric-data-extension\u0026subdirectory=collect-raw-metric-data-extension\"\n```\nRemember to set the `SERVICE` environment variable for naming the metric file.\n\n---\n\n## 🔐 **Services**\n\nExecuting this test suite is a time-intensive process. To cater to this, the following mechanisms are in place:\n\n\n| Mechanism     | Description                                                                                                                                                   |\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Blacklisting**  | Services devoid of tests are blacklisted to avoid needless execution.                                                                                         |\n| **Ignored**       | Services might have test cases, but if they all fail leading to timeouts, they're marked as non-functional and bypassed. Refer to `terraform_pytest/utils.py`. |\n| **Partitioning**  | Some services are extensive and get divided into partitions. Each partition holds a unique subset of tests for that particular service.                          |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Flocalstack-terraform-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack%2Flocalstack-terraform-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Flocalstack-terraform-test/lists"}