# Provider determines the method (AWS) and some basic provider properties
provider "aws" {
  region = var.region
}

# Terraform backends cannot contain interpolations - of the form ${var.environment}-${var.service_name}-state
terraform {
  backend "s3" {
    bucket  = "orcd-terraform-state"
    key     = "qa/ddex-ingester/lambda-dummy/terraform.tfstate"
    region  = "us-east-1"
    encrypt = true
  }
}

module "vpc_info" {
  source = "git@github.com:theorchard/terraform-vpc-info.git?ref=3.1.0"

  environment = var.environment
}

module "lambda_dummy" {
  source = "git@github.com:theorchard/terraform-lambda.git//?ref=3.1.4"

  environment              = var.environment
  application_family       = var.application_family
  use_custom_function_name = true
  custom_function_name     = "${var.service_name}-dummy-${var.environment}"
  lambda_name              = "${var.service_name}-dummy"
  lambda_description       = "Dummy for modules to point to if we can't remove them"
  use_container_image      = true
  datadog_advanced_enabled = true

  lambda_function_timeout                        = var.lambda_default_timeout
  vpc_id                                         = module.vpc_info.vpc_id
  vpc_subnet_ids                                 = module.vpc_info.default_private_subnet_ids
  lambda_function_reserved_concurrent_executions = 1
  datadog_enabled                                = var.datadog_enabled
  iam_managed_policy_attachments                 = []
}
