Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a localstack sample available? #375

Open
pablobuild opened this issue Nov 8, 2022 · 1 comment
Open

Is there a localstack sample available? #375

pablobuild opened this issue Nov 8, 2022 · 1 comment

Comments

@pablobuild
Copy link

Is there a localstack sample available?

@khuezy
Copy link

khuezy commented Nov 9, 2022

Something like:

docker-compose.yml

  # Local Stack
  localstack:
    image: localstack/localstack:latest
    environment:
      - LAMBDA_EXECUTION_ROLE=docker-reuse
      - AWS_ACCESS_KEY_ID=test
      - AWS_SECRET_ACCESS_KEY=test
      - AWS_DEFAULT_REGION=us-west-2
      - DOCKER_HOST=unix:///var/run/docker.sock
      - SERVICES=lambda,cloudwatch,sqs,iam,events
    ports:
      - '4566-4583:4566-4583'

terraform/modules/localstack/main.tf

provider "aws" {
  region = "us-west-2"
  # access_key = "fake"
  # secret_key = "fake"
  skip_credentials_validation = false
  skip_metadata_api_check = true
  skip_requesting_account_id = false

  endpoints {
    lambda      = "http://localhost:4566"
    iam      = "http://localhost:4566"
    sqs         = "http://localhost:4566"
    cloudwatch  = "http://localhost:4566"
    cloudwatchlogs = "http://localhost:4566"
    events = "http://localhost:4566"
  }
}

# Modules
module "yourmodule" {
  source = "../modules/yourmodule"

  environment = "local"
  database_url = var.DATABASE_URL
}

Then cd to the localstack module and run terraform init then terraform apply to launch a localstack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants