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

Support for localstack AWS testing #519

Open
meltingturret opened this issue Apr 12, 2023 · 1 comment
Open

Support for localstack AWS testing #519

meltingturret opened this issue Apr 12, 2023 · 1 comment

Comments

@meltingturret
Copy link

meltingturret commented Apr 12, 2023

Any thoughts on an easy way for configure terraform kitchen to converge against localstack? For verification I am using awsspec and the verifier does respond to http_proxy configuration fine but the provisioner does not.

driver:
  name: "terraform"
  variable_files:
    - testing.tfvars

provisioner:
  name: "terraform"

platforms:
  - name: "aws"

verifier:
  name: "awspec"

suites:
  - name: default
    verifier:
      #default_pattern: true
      patterns:
        - spec/**/*_spec.rb

When I run bundle exec kitchen converge aws is updated and not localstack running on http://localhost:4566.

I want to avoid adding this in the aws provider:

provider "aws" {
  endpoints {
    ec2            = "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"
  }
}
@aaron-lane
Copy link
Collaborator

Hi @meltingturret 👋🏼

Based on the AWS provider documentation, it does not appear that there is any alternative to specifying the custom endpoints within the provider configuration. If you would like to avoid hard-coding that configuration in your main module then I suggest you create a separate test module which invokes your main module and includes the necessary provider configuration. You can override which module Kitchen-Terraform tests using the transport.root_module_directory configuration.

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

No branches or pull requests

2 participants