Skip to content

Quine Enterprise Terraform Module for AWS

Deploys Quine Enterprise on AWS ECS Fargate using the terraform-aws-quine-enterprise module.

Prerequisites

  • Terraform >= 1.5.0
  • AWS CLI configured with credentials
  • Route53 hosted zone (for HTTPS)
  • Quine Enterprise license key, which you store in AWS Secrets Manager in Step 2
  • The Quine Enterprise container image in a registry your ECS tasks can pull from without credentials, such as an Amazon ECR repository in your AWS account. The module does not configure registry credentials, so the tasks cannot pull from thatDot's private registry directly.

Usage

Step 1: Create the Terraform files

Create the following files in a new directory:

terraform {
  required_version = ">= 1.5.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 5.0"
    }
  }
}

provider "aws" {
  region = var.aws_region
}

resource "aws_acm_certificate" "this" {
  domain_name       = var.domain_name
  validation_method = "DNS"

  lifecycle {
    create_before_destroy = true
  }
}

resource "aws_route53_record" "cert_validation" {
  for_each = {
    for dvo in aws_acm_certificate.this.domain_validation_options : dvo.domain_name => {
      name   = dvo.resource_record_name
      record = dvo.resource_record_value
      type   = dvo.resource_record_type
    }
  }

  zone_id = var.hosted_zone_id
  name    = each.value.name
  type    = each.value.type
  records = [each.value.record]
  ttl     = 60
}

resource "aws_acm_certificate_validation" "this" {
  certificate_arn         = aws_acm_certificate.this.arn
  validation_record_fqdns = [for record in aws_route53_record.cert_validation : record.fqdn]
}

module "quine_enterprise" {
  source = "github.com/thatdot/terraform-aws-quine-enterprise?ref=v2.0.0"

  project_name           = var.project_name
  container_image        = var.container_image
  license_key_secret_arn = var.license_key_secret_arn

  enable_https    = true
  certificate_arn = aws_acm_certificate.this.arn

  depends_on = [aws_acm_certificate_validation.this]
}

resource "aws_route53_record" "alb_alias" {
  zone_id = var.hosted_zone_id
  name    = var.domain_name
  type    = "A"

  alias {
    name                   = module.quine_enterprise.alb_dns_name
    zone_id                = module.quine_enterprise.alb_zone_id
    evaluate_target_health = true
  }
}
variable "aws_region" {
  description = "AWS region"
  type        = string
  default     = "us-west-2"
}

variable "project_name" {
  description = "Project name for resource naming"
  type        = string
}

variable "container_image" {
  description = "Quine Enterprise container image"
  type        = string
}

variable "license_key_secret_arn" {
  description = "ARN of the AWS Secrets Manager secret that holds the Quine Enterprise license key"
  type        = string
}

variable "domain_name" {
  description = "Domain name for HTTPS (e.g., quine.example.com)"
  type        = string
}

variable "hosted_zone_id" {
  description = "Route53 hosted zone ID"
  type        = string
}
output "url" {
  description = "URL to access Quine Enterprise"
  value       = "https://${var.domain_name}"
}

output "alb_dns_name" {
  description = "ALB DNS name"
  value       = module.quine_enterprise.alb_dns_name
}

output "ecs_cluster_name" {
  description = "ECS cluster name"
  value       = module.quine_enterprise.ecs_cluster_name
}

output "cloudwatch_log_group" {
  description = "CloudWatch log group"
  value       = module.quine_enterprise.cloudwatch_log_group_name
}
project_name           = "quine-enterprise"
container_image        = "your-registry/quine-enterprise:latest"
license_key_secret_arn = "" # Required: ARN of the Secrets Manager secret holding your license key
domain_name            = "quine-enterprise.example.com"
hosted_zone_id         = "Z0123456789ABCDEFGHIJ"

Step 2: Store the license key in AWS Secrets Manager

The module passes the license key to Quine Enterprise from AWS Secrets Manager, which keeps the key out of the ECS task definition and the container logs. Create the secret with the AWS CLI rather than in Terraform, so the key stays out of Terraform state too. With your license key in the QUINE_LICENSE_KEY environment variable, run:

aws secretsmanager create-secret \
  --name quine-enterprise/license-key \
  --secret-string "$QUINE_LICENSE_KEY" \
  --query ARN --output text

The command prints the secret's ARN, which you use in the next step.

Two things follow from ECS reading the secret each time a task starts:

  • The tasks' subnets need a route to Secrets Manager: a NAT gateway, a public IP (the module assigns one by default), or a secretsmanager VPC interface endpoint.
  • Changing the secret's value doesn't restart running tasks. After you rotate the key, start new tasks with this command, where <project_name> is the project_name from terraform.tfvars:

    aws ecs update-service \
      --cluster <project_name>-cluster \
      --service <project_name>-service \
      --force-new-deployment
    

Step 3: Configure variables

Copy the example variables file and edit it with your values:

cp terraform.tfvars.example terraform.tfvars

Fill in the required values in terraform.tfvars:

  • domain_name - Your domain (e.g., quine-enterprise.example.com)
  • hosted_zone_id - Route53 zone ID for your domain
  • container_image - Your Quine Enterprise container image and tag, in the registry from the prerequisites
  • license_key_secret_arn - The ARN that Step 2 printed. Use the complete ARN, including the random suffix Secrets Manager adds to the secret name.

Step 4: Deploy

terraform init
terraform plan
terraform apply

Once complete, access Quine Enterprise at https://<your-domain-name>.

Cleanup

terraform destroy