fakecloud – Free, open-source AWS emulator (LocalStack alternative)

5 points by pedrocarlos


mdaniel

If anyone else is interested in using terraform against any of these AWS emulators, one need not dirty the actual provider.tf with overrides they have a formal mechanism for doing that https://developer.hashicorp.com/terraform/language/files/override

e.g.

cat > provider_aws_endpoints_override.tf <<HCL
provider aws {
  # skip_credentials_validation = true
  # skip_metadata_api_check     = true
  endpoints {
    s3               = "http://localhost:4566"
    # ...etc...
  }
}
HCL

and there is also the "patch-em-all" flavor by introspecting the aws provider schema:

gen_overrides() {
  echo '
provider aws {
  # skip_credentials_validation = true
  # skip_metadata_api_check     = true
  endpoints {
'
tofu providers schema -json \
    | jq -r '
.provider_schemas | to_entries[] as $e
| select($e.key|test("/aws$"))
| $e.value.provider.block.block_types.endpoints.block.attributes
| keys[] as $k
| "\($k) = \"http://127.0.0.1:4566\""
'
    echo '  }'
    echo '}'
}
gen_overrides > provider_aws_endpoints_override.tf

I have a similar script for the GCP provider but it's much, much uglier due to GCP's path-based dispatch versus AWS's (mostly) (root XML element + Authorization + HTTP header) based service dispatch