{"id":18636687,"url":"https://github.com/localstack/terraform-local","last_synced_at":"2025-04-05T03:07:17.463Z","repository":{"id":40243949,"uuid":"473695636","full_name":"localstack/terraform-local","owner":"localstack","description":"Terraform CLI wrapper to deploy your Terraform applications directly to LocalStack","archived":false,"fork":false,"pushed_at":"2024-03-22T20:10:10.000Z","size":48,"stargazers_count":146,"open_issues_count":6,"forks_count":21,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-03-22T21:27:33.702Z","etag":null,"topics":["localstack","terraform"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","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":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2022-03-24T16:53:45.000Z","updated_at":"2024-06-19T04:09:06.219Z","dependencies_parsed_at":"2024-06-19T04:09:01.824Z","dependency_job_id":"152660fa-fab5-482e-a6bf-78b794ad7c89","html_url":"https://github.com/localstack/terraform-local","commit_stats":{"total_commits":23,"total_committers":10,"mean_commits":2.3,"dds":0.4347826086956522,"last_synced_commit":"5e38349742cafe531c208ce361afbe6efdd203d6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Fterraform-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Fterraform-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Fterraform-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Fterraform-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack","download_url":"https://codeload.github.com/localstack/terraform-local/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280263,"owners_count":20912967,"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":["localstack","terraform"],"created_at":"2024-11-07T05:31:13.348Z","updated_at":"2025-04-05T03:07:17.442Z","avatar_url":"https://github.com/localstack.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![Build status](https://github.com/localstack/terraform-local/actions/workflows/build.yml/badge.svg)](https://github.com/localstack/terraform-local/actions)\n\n# `tflocal` - Terraform with LocalStack\n\nThis package provides `tflocal` - a small wrapper script to run [Terraform](https://terraform.io) against [LocalStack](https://localstack.cloud).\n\n## Prerequisites\n\n* Python 3.x\n* `pip`\n* `terraform`\n\n## How it works\n\nThe script uses the [Terraform Override mechanism](https://www.terraform.io/language/files/override) and creates a temporary file `localstack_providers_override.tf` to configure the endpoints for the AWS `provider` section. The endpoints for all services are configured to point to the LocalStack API (`http://localhost:4566` by default).\n\n## Installation\n\nThe `tflocal` command line interface can be installed via `pip`:\n```\npip install terraform-local\n```\n\n## Configurations\n\nThe following environment variables can be configured:\n* `DRY_RUN`: Generate the override file without invoking Terraform\n* `TF_CMD`: Terraform command to call (default: `terraform`)\n* `AWS_ENDPOINT_URL`: hostname and port of the target LocalStack instance\n* `LOCALSTACK_HOSTNAME`: __(Deprecated)__ host name of the target LocalStack instance\n* `EDGE_PORT`: __(Deprecated)__ port number of the target LocalStack instance\n* `S3_HOSTNAME`: special hostname to be used to connect to LocalStack S3 (default: `s3.localhost.localstack.cloud`)\n* `USE_EXEC`: whether to use `os.exec` instead of `subprocess.Popen` (try using this in case of I/O issues)\n* `\u003cSERVICE\u003e_ENDPOINT`: setting a custom service endpoint, e.g., `COGNITO_IDP_ENDPOINT=http://example.com`\n* `AWS_DEFAULT_REGION`: the AWS region to use (default: `us-east-1`, or determined from local credentials if `boto3` is installed)\n* `CUSTOMIZE_ACCESS_KEY`: enables to override the static AWS Access Key ID. The following cases are taking precedence over each other from top to bottom:\n    * `AWS_ACCESS_KEY_ID` environment variable is set\n    * `access_key` is set in the Terraform AWS provider\n    * `AWS_PROFILE` environment variable is set and configured\n    * `AWS_DEFAULT_PROFILE` environment variable is set and configured\n    * `default` profile's credentials are configured\n    * falls back to the default `AWS_ACCESS_KEY_ID` mock value\n* `AWS_ACCESS_KEY_ID`: AWS Access Key ID to use for multi account setups (default: `test` -\u003e account ID: `000000000000`)\n* `SKIP_ALIASES`: Allows to skip generating AWS provider overrides for specified aliased providers, e.g. `SKIP_ALIASES=aws_secrets,real_aws`\n* `ADDITIONAL_TF_OVERRIDE_LOCATIONS`: Comma-separated list of folder paths that will also receive a temporary `localstack_providers_override.tf` file\n\n## Usage\n\nThe `tflocal` command has the same usage as the `terraform` command. For detailed usage,\nplease refer to the man pages of `terraform --help`.\n\n### Validation errors when using local terraform modules\n\nNote that if your project uses local terraform modules, and those modules reference providers, those folders *also* need to receive a temporary `localstack_providers_override.tf` file. Without it, you would get an error that looks like this when starting to process code from inside the module\n\n```\n╷\n│ Error: No valid credential sources found\n│ \n│   with module.lambda.provider[\"registry.terraform.io/hashicorp/aws\"],\n│   on ../../providers.tf line 11, in provider \"aws\":\n│   11: provider \"aws\" {\n│ \n│ Please see https://registry.terraform.io/providers/hashicorp/aws\n│ for more information about providing credentials.\n│ \n│ Error: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, access disabled to EC2 IMDS via client option, or \"AWS_EC2_METADATA_DISABLED\" environment variable\n```\n\nTo address this issue, you may include a comma-separated list of folder paths that will recieve additional override files via an environment variable\n\n```\nADDITIONAL_TF_OVERRIDE_LOCATIONS=/path/to/module1,path/to/module2 tflocal plan\n```\n\n[See this issue for more discussion](https://github.com/localstack/terraform-local/issues/67)\n\n## Change Log\n\n* v0.21.0: Add ability to drop an override file in additional locations\n* v0.20.1: Fix list config rendering\n* v0.20.0: Fix S3 backend option merging\n* v0.19.0: Add `SKIP_ALIASES` configuration environment variable\n* v0.18.2: Fix warning on aliased custom endpoint names\n* v0.18.1: Fix issue with not proxied commands\n* v0.18.0: Add `DRY_RUN` and patch S3 backend entrypoints\n* v0.17.1: Add `packaging` module to install requirements\n* v0.17.0: Add option to use new endpoints S3 backend options\n* v0.16.1: Update Setuptools to exclude tests during packaging\n* v0.16.0: Introducing semantic versioning and AWS_ENDPOINT_URL variable\n* v0.15: Update endpoint overrides for Terraform AWS provider 5.22.0\n* v0.14: Add support to multi-account environments\n* v0.13: Fix S3 automatic `use_s3_path_style` detection when setting S3_HOSTNAME or LOCALSTACK_HOSTNAME\n* v0.12: Fix local endpoint overrides for Terraform AWS provider 5.9.0; fix parsing of alias and region defined as value lists\n* v0.11: Minor fix to handle boolean values in S3 backend configs\n* v0.10: Add support for storing state files in local S3 backends\n* v0.9: Fix unsupported provider override for emrserverless\n* v0.8: Configure the endpoint for opensearch service\n* v0.7: Add initial support for provider aliases\n* v0.6: Fix selection of default region\n* v0.5: Make AWS region configurable, add `region` to provider config\n* v0.4: Fix using use_s3_path_style for S3_HOSTNAME=localhost; exclude `meteringmarketplace` service endpoint\n* v0.3: Fix support for -chdir=... to create providers file in target directory\n* v0.2: Add ability to specify custom endpoints; pass INT signals to subprocess\n* v0.1: Initial release\n\n## License\n\nThis software library is released under the Apache License, Version 2.0 (see `LICENSE`).\n\n[pypi-version]: https://img.shields.io/pypi/v/terraform-local.svg\n[pypi]: https://pypi.org/project/terraform-local/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Fterraform-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack%2Fterraform-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Fterraform-local/lists"}