## Parent terragrunt file for LocalStack infra
### Create local variables
locals {
  environment    = "local"
  node_env       = "development"
  region         = get_env("AWS_REGION", "us-east-1")
  aws_account_id = "000000000000"
}

inputs = {
  environment    = local.environment
  region         = local.region
  aws_account_id = local.aws_account_id
}
# Version requirements
terragrunt_version_constraint = ">= 0.53.0, < 0.53.6"

### Please, do not touch this part
generate "versions" {
  path      = "versions_override.tf"
  if_exists = "overwrite_terragrunt"
  contents  = <<EOF
    terraform {
      required_version = ">= 1.5.0"
      required_providers {
        aws = {
          source = "hashicorp/aws"
          version = "=5.26.0"
        }
      }
    }
    EOF
}

generate "provider" {
  path      = "provider.tf"
  if_exists = "overwrite"
  contents  = <<EOF
    provider "aws" {
      access_key                  = "test"
      secret_key                  = "test"
      region                      = "${local.region}"
      s3_use_path_style           = false
      skip_credentials_validation = true
      skip_metadata_api_check     = true
      skip_requesting_account_id  = true
      skip_region_validation      = true
      endpoints {
        apigateway     = "http://localhost:4566"
        apigatewayv2   = "http://localhost:4566"
        cloudformation = "http://localhost:4566"
        cloudwatch     = "http://localhost:4566"
        cloudwatchlogs = "http://localhost:4566"
        dynamodb       = "http://localhost:4566"
        ec2            = "http://localhost:4566"
        es             = "http://localhost:4566"
        elasticache    = "http://localhost:4566"
        firehose       = "http://localhost:4566"
        iam            = "http://localhost:4566"
        kinesis        = "http://localhost:4566"
        lambda         = "http://localhost:4566"
        rds            = "http://localhost:4566"
        redshift       = "http://localhost:4566"
        route53        = "http://localhost:4566"
        s3             = "http://s3.localhost.localstack.cloud:4566"
        secretsmanager = "http://localhost:4566"
        ses            = "http://localhost:4566"
        sns            = "http://localhost:4566"
        sqs            = "http://localhost:4566"
        ssm            = "http://localhost:4566"
        stepfunctions  = "http://localhost:4566"
        sts            = "http://localhost:4566"
      }
    }
  EOF
}
