• Stars
    star
    181
  • Rank 212,110 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Terraform CLI wrapper to deploy your Terraform applications directly to LocalStack

Build status

tflocal - Terraform with LocalStack

This package provides tflocal - a small wrapper script to run Terraform against LocalStack.

Prerequisites

  • Python 3.x
  • pip
  • terraform

How it works

The script uses the Terraform Override mechanism 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).

Installation

The tflocal command line interface can be installed via pip:

pip install terraform-local

Configurations

The following environment variables can be configured:

  • TF_CMD: Terraform command to call (default: terraform)
  • AWS_ENDPOINT_URL: hostname and port of the target LocalStack instance
  • LOCALSTACK_HOSTNAME: (Deprecated) host name of the target LocalStack instance
  • EDGE_PORT: (Deprecated) port number of the target LocalStack instance
  • S3_HOSTNAME: special hostname to be used to connect to LocalStack S3 (default: s3.localhost.localstack.cloud)
  • USE_EXEC: whether to use os.exec instead of subprocess.Popen (try using this in case of I/O issues)
  • <SERVICE>_ENDPOINT: setting a custom service endpoint, e.g., COGNITO_IDP_ENDPOINT=http://example.com
  • AWS_DEFAULT_REGION: the AWS region to use (default: us-east-1, or determined from local credentials if boto3 is installed)
  • 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:
    • AWS_ACCESS_KEY_ID environment variable is set
    • access_key is set in the Terraform AWS provider
    • AWS_PROFILE environment variable is set and configured
    • AWS_DEFAULT_PROFILE environment variable is set and configured
    • default profile's credentials are configured
    • falls back to the default AWS_ACCESS_KEY_ID mock value
  • AWS_ACCESS_KEY_ID: AWS Access Key ID to use for multi account setups (default: test -> account ID: 000000000000)

Usage

The tflocal command has the same usage as the terraform command. For detailed usage, please refer to the man pages of terraform --help.

Change Log

  • v0.16.1: Update Setuptools to exclude tests during packaging
  • v0.16.0: Introducing semantic versioning and AWS_ENDPOINT_URL variable
  • v0.15: Update endpoint overrides for Terraform AWS provider 5.22.0
  • v0.14: Add support to multi-account environments
  • v0.13: Fix S3 automatic use_s3_path_style detection when setting S3_HOSTNAME or LOCALSTACK_HOSTNAME
  • v0.12: Fix local endpoint overrides for Terraform AWS provider 5.9.0; fix parsing of alias and region defined as value lists
  • v0.11: Minor fix to handle boolean values in S3 backend configs
  • v0.10: Add support for storing state files in local S3 backends
  • v0.9: Fix unsupported provider override for emrserverless
  • v0.8: Configure the endpoint for opensearch service
  • v0.7: Add initial support for provider aliases
  • v0.6: Fix selection of default region
  • v0.5: Make AWS region configurable, add region to provider config
  • v0.4: Fix using use_s3_path_style for S3_HOSTNAME=localhost; exclude meteringmarketplace service endpoint
  • v0.3: Fix support for -chdir=... to create providers file in target directory
  • v0.2: Add ability to specify custom endpoints; pass INT signals to subprocess
  • v0.1: Initial release

License

This software library is released under the Apache License, Version 2.0 (see LICENSE).

More Repositories

1

localstack

πŸ’» A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
Python
53,666
star
2

awscli-local

πŸ’² "awslocal" - Thin wrapper around the "aws" command line interface for use with LocalStack
Python
1,047
star
3

serverless-localstack

⚑ Serverless plugin for running against LocalStack
JavaScript
515
star
4

aws-cdk-local

Thin wrapper script for using the AWS CDK CLI with LocalStack
JavaScript
261
star
5

localstack-python-client

🐍 A lightweight Python client for LocalStack
Python
174
star
6

localstack-pro-samples

Sample projects to demonstrate advanced LocalStack features
Makefile
153
star
7

localstack-java-utils

β˜• Java utilities and JUnit integration for LocalStack
Java
75
star
8

pulumi-local

Thin wrapper script to use Pulumi with LocalStack
Python
71
star
9

plux

A dynamic code loading framework for building pluggable Python distributions
Python
71
star
10

localstack-terraform-samples

Repository with terraform samples for LocalStack
HCL
66
star
11

localstack-demo

Simple demo application deployed using LocalStack
Makefile
61
star
12

docs

The LocalStack documentation πŸ“–
HTML
60
star
13

helm-charts

Helm Charts for LocalStack
Smarty
57
star
14

aws-sam-cli-local

Simple wrapper around AWS SAM CLI for use with LocalStack
Python
52
star
15

localstack-docker-extension

Simple Docker Extension to control and manage your LocalStack instance
TypeScript
39
star
16

localstack-extensions

🧩 Extend and customize LocalStack with LocalStack Extensions (beta)
Python
35
star
17

awesome-localstack

A curated list of LocalStack integrations, tools, frameworks, and platforms.
27
star
18

setup-localstack

Sets up LocalStack CLI in your GitHub Actions workflow ☁️
25
star
19

localstack-terraform-test

Utilities to run Terraform tests against LocalStack
Python
24
star
20

chalice-local

Small wrapper script to use AWS Chalice with LocalStack
Python
21
star
21

verdin

A Tinybird SDK for Python 🐦
Python
21
star
22

amplify-js-local

Simple wrapper script to allow using the Amplify JS SDK with LocalStack
JavaScript
19
star
23

serverless-python-rest-api-with-dynamodb

Serverless CRUD service exposing a REST HTTP interface integrated with LocalStack
Python
18
star
24

cockpit

LocalStack Cockpit Desktop application
17
star
25

localstack-on-k8s

Sample repository that illustrates running LocalStack on Kubernetes
Python
16
star
26

localstack-desktop

The official LocalStack Desktop Application
16
star
27

localstack-workshop

Repository with code samples for the LocalStack workshop
JavaScript
14
star
28

localstack.github.io

LocalStack website
HTML
12
star
29

localstack-cli

The LocalStack CLI packaged using pyinstaller
Makefile
12
star
30

localstack-vscode-extension

LocalStack VSCode Extension: Deploy Lambda functions to LocalStack
TypeScript
12
star
31

azure-cli-local

[unmaintained] Simple wrapper script to use Azure CLI with LocalStack
Python
11
star
32

presentations

Presentations, talks, and demos about LocalStack
HCL
10
star
33

rolo

A Python framework for building HTTP-based server applications
Python
10
star
34

localstack-github-actions-login

GitHub Action to log-in into your LocalStack account on your GitHub Actions runners
JavaScript
9
star
35

localstack-aws-sdk-examples

Test repo with sample apps & tests for various different languages/SDKs using LocalStack
Java
8
star
36

appsync-utils

Implementation of AppSync JavaScript utilities
JavaScript
8
star
37

localstack-artifacts

Miscellaneous build artifacts for the LocalStack platform
Java
7
star
38

serverless-streaming-data-pipeline

A serverless streaming data pipeline running on LocalStack
Python
7
star
39

cloud-pods

Sample repository illustrating Cloud Pods for LocalStack
JavaScript
7
star
40

local-surf

πŸ„ LocalSurf - a browser plugin to redirect AWS service calls to LocalStack
JavaScript
6
star
41

serverless-api-ecs-apigateway-sample

Serverless Container-based APIs with Amazon ECS and Amazon API Gateway deployed using LocalStack
HCL
6
star
42

localstack-moto-test-coverage

Repo to run moto integration tests against LocalStack for moto-fallback coverage
Python
6
star
43

ci-plugin-circleci

CircleCI Plugin (Orb) for easy configuration of LocalStack CI builds
Shell
5
star
44

localstack-plugin-loader

The dynamic code loading framework used in LocalStack
Python
5
star
45

architect-local

Architect CLI (arc.codes) for use with LocalStack
JavaScript
5
star
46

mnist-sagemaker

Demo to run the MNIST handwritten digit model on a locally running SageMaker endpoint
JavaScript
5
star
47

awslamba-go-runtime

Custom Golang runtime for the execution of AWS Lambdas
Go
5
star
48

.github

Community health files for the @localstack organization
5
star
49

localstack-pulumi-samples

Sample Pulumi projects to demonstrate LocalStack features
Python
4
star
50

localstack-stripe

Use the Stripe API in LocalStack
Python
4
star
51

amplify-localstack

Amplify Plugin to deploy resources into Localstack
JavaScript
4
star
52

snowflake-docs

Private repo for LocalStack's Snowflake emulator docs
HTML
4
star
53

homebrew-tap

Ruby
4
star
54

tinybird-workflow-push

Push Github Workflow data to tinybird
TypeScript
4
star
55

devops-barcelona-2022

LocalStack @ DevOps Bareclona 2022
Python
3
star
56

localstack-python-utils

Localstack utility for tests
Python
3
star
57

branding

Repository with various LocalStack branding assets
3
star
58

localstack-docker-debug

Python
3
star
59

pre-commit-hooks

Pre commit hooks for LocalStack repositories
Python
3
star
60

localstack-snapshot

Extracted snapshot testing library for LocalStack
Python
3
star
61

serverless-image-resizer

Serverless Image Resizer demo app for LocalStack
Python
2
star
62

cloud-pod-badge

2
star
63

appsync-graphql-api-sample

Proxy data from different resources such as DynamoDB tables & RDS databases using AppSync GraphQL APIs deployed using Serverless Framework on LocalStack
Shell
2
star
64

meta

Tooling to manage repos in the localstack org
2
star
65

localstack-dev-spaces

Sample repo for running LocalStack in Redhat Openshift Dev Spaces
Dockerfile
2
star
66

devcontainer-feature

LocalStack DevContainer Feature(s)
Shell
2
star
67

aws-java-sdk-v2-trust-certs-patch

A small java agent to patch the AWS Java SDK v2 to disable certificate name validation.
Java
1
star
68

localstack-blog.github.io

LocalStack blog
HTML
1
star
69

troubleshooting-issues

Repository of samples to reproduce localstack issues
Python
1
star
70

loan-broker-stepfunctions-lambda-app

TypeScript
1
star
71

shipyard-localstack-flask

a starter Flask project, integrated with Localstack and Shipyard
Python
1
star
72

reinvent-challenge

Repository for re:Invent "scavenger hunt" using LocalStack
Shell
1
star
73

azure-functions-local

Small wrapper script to use Azure Functions core tools with LocalStack
1
star