# An S3 bucket and an SQS queue in Vera's local AWS emulator.
#
# Needs Vera running on this machine, serving AWS at http://127.0.0.1:5003
# (https://docs.vera-platforms.com/get-started/), and Terraform 1.15 or later.
# No AWS account is used: the provider has dummy credentials and sends every
# request to Vera.
#
# In an empty folder holding only this file:
#   terraform init      downloads the hashicorp/aws provider
#   terraform apply     plans 2 to add; type yes to create them
#   terraform destroy   removes them from Vera

terraform {
  required_version = ">= 1.15.0, < 2.0.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "6.69.0"
    }
  }
}

provider "aws" {
  region                      = "us-east-1"
  access_key                  = "test"
  secret_key                  = "test"
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true
  skip_region_validation      = true
  s3_use_path_style           = true

  endpoints {
    s3  = "http://127.0.0.1:5003"
    sqs = "http://127.0.0.1:5003"
    sts = "http://127.0.0.1:5003"
  }
}

resource "aws_s3_bucket" "example" {
  bucket = "vera-example-bucket"
}

resource "aws_sqs_queue" "example" {
  name = "vera-example-queue"
}
