SurveyCX for Amazon Connect

Help center › Deploying with Terraform

Deploying with Terraform

Accounts run from Terraform can deploy SurveyCX as a module. It wraps the published CloudFormation release in one aws_cloudformation_stack resource: the same template the Marketplace launch button and the CLI use, pinned to a version, with every stack parameter as a Terraform variable and the stack's outputs as module outputs. Nothing is installed from anywhere but EKPK's release bucket, and upgrading is a change of release_version.

module "surveycx" {
  source = "github.com/Kouros99999/surveycx//terraform?ref=0.6.0"

  stack_name           = "surveycx"
  release_version      = "0.6.0"
  connect_instance_id  = "11111111-2222-3333-4444-555555555555"
  connect_instance_url = "https://myinstance.my.connect.aws"
  alarm_email          = "[email protected]"
  timezone             = "America/New_York"
  data_export          = true

  tags = { Environment = "production" }
}

output "site_url"        { value = module.surveycx.site_url }
output "flow_lambda_arn" { value = module.surveycx.flow_lambda_arn }
output "stream_arn"      { value = module.surveycx.stream_arn }

terraform apply takes 15 to 25 minutes the first time (the CloudFront distribution and the site installer are the slow parts). Then follow Getting started from step 3: add the flow function to the Connect instance, import the flow module, send contact records to the stream.

Variables

Every parameter in the settings reference is a variable with the same name in snake_case (VerbatimAnalysis becomes verbatim_analysis), with enabled/disabled parameters as booleans. A variable left out is not sent, so the template's default applies and an existing stack keeps its previous value on update. custom_domain and certificate_arn put the site on your own host name, with distribution_domain_name as the CNAME target. Two names differ: provider_platform stands in for the Provider parameter (provider is reserved in Terraform), and release_version picks the release. release_bucket and release_region point at EKPK's public bucket by default; a partner mirroring releases sets its own.

The module needs the AWS provider 5.0 or later and Terraform 1.5 or later. The stack is created with CAPABILITY_IAM, CAPABILITY_NAMED_IAM and CAPABILITY_AUTO_EXPAND, which the template requires.

Upgrades, rollback, removal

Change release_version and apply: CloudFormation changes only what differs and rolls back on failure, and the previous version is the rollback. Terraform's plan shows the parameter change; the resource-level diff is in CloudFormation's change set in the console. Release notes say when a version needs a parameter or a manual step. The stack's resources are not in your Terraform state individually, so terraform destroy removes the whole stack, including the responses table; export your data first (see Export).

Marketplace

A stack deployed with Terraform is billed through AWS Marketplace like any other when you pass the three values the registration page shows after subscribing: marketplace_product_code, marketplace_license_arn and marketplace_customer_account_id. Without them the stack runs as a pilot or direct deal.

The module's source is in the terraform/ directory of the repository, with a worked example under terraform/examples/connect.

Current as of version 0.11.0. See the release notes for what changed since.