Use when writing or reviewing Terraform for Amazon Connect: contact flows and flow modules, a Lambda function invoked from a flow, queues, routing profiles, security profiles and access-control tags, users, approved origins, adopting console-built resources, PHI in flow logs and contact attributes, or contact events to EventBridge and SQS. Not for general Lambda tuning (aws-serverless) or IAM and pipelines (terraform-aws).
96%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Medium
Suggest reviewing before use
Connect fails quietly. A flow that references an unassociated Lambda fails to save with no reason given. A security profile tag that matches nothing hides every queue. A value returned from a Lambda is kept for 24 months. Each rule below is here because it fails without an error.
Before you write or review anything, list each Connect resource and who edits it: Terraform or the console. Most Connect instances already have console-built flows, queues and hours, and people keep editing flows in the console after Terraform arrives.
| Owner | Do this |
|---|---|
| Terraform | Manage it. A console edit is drift, and the next apply reverts it. Say so in the repository's agent instructions. |
| Console | If Terraform created or adopted it, take it out of state with a removed block and lifecycle { destroy = false }, which does not delete it. Then read it with a data source (aws_connect_queue, aws_connect_security_profile, aws_connect_contact_flow). |
| Moving from the console to Terraform | For the transition only, set lifecycle { ignore_changes = [content] } on the flow while the console edits are ported into code. Before you remove it, export the live content and port it back, or the apply reverts the console edits. ignore_changes keeps the flow in state, so a type change or a destroy still replaces or deletes it. |
| Built in the console, Terraform from now on | Adopt it: an import {} block, plus lifecycle { prevent_destroy = true } when flows, numbers or campaigns depend on it. |
The step is complete when every resource in the root has one owner. If the answer is "both", which forces a -target on every apply, report it as a finding. Standing -target applies are partial applies that nobody reviews as a whole. The fix is one owner for each resource: move the console edits into code, or hand the resource to the console with removed and a data source (terraform-aws → references/terraform-structure.md → "One owner per resource").
aws_lambda_permission (principal connect.amazonaws.com, source_arn the instance ARN) lets Connect invoke the function. aws_connect_lambda_function_association puts it on the instance's list. Without the association, the flow or module save fails with InvalidContactFlowException and no detail. Add depends_on on the association to the flow resource.verified=true and reason=FAILED. Let the agent application fetch details from its own backend by contact ID.reason=ERROR, that the flow can route on. The flow's Error branch then means only a timeout or an INIT failure.Details, limits and sources are in references/lambda-in-flows.md.
Queue.aws_connect_security_profile cannot set access-control tags. See the provider gaps below.Details, limits and sources are in references/access-control.md.
These were checked against the provider docs, verified 2026-11-15.
| Need | hashicorp/aws | Alternative |
|---|---|---|
| Access-control tags on a security profile | None (aws_connect_security_profile has permissions and tags only) | awscc_connect_security_profile (allowed_access_control_tags, tag_restricted_resources). Needs Cloud Control API permissions |
| Approved origins (for an embedded CCP) | None | awscc_connect_approved_origin |
| Phone number to flow | aws_connect_phone_number_contact_flow_association | |
| Instance-level Lambda list | aws_connect_lambda_function_association |
If you fall back to terraform_data with a local-exec AWS CLI call, Terraform cannot read the result back. A console edit then stays in place until a triggers_replace input changes. For access-control tags, that means a widened supervisor scope stays unnoticed. Record the gap, and add a scheduled check that compares describe-security-profile against the code.
A console export is not Connect flow language, so the resource cannot use it. Export with aws connect describe-contact-flow and take .ContactFlow.Content. To author flows in HCL, and to validate them at plan time, read references/flows-as-code.md.
Contact events arrive on the default EventBridge bus with source aws.connect, on a best-effort basis and in no particular order. Consumers order them by timestamp and stay idempotent. EventBridge drops a permission error without retrying it, and an SQS DLQ does not catch those events. The rule pattern, the target DLQ and the S3 notifications for Contact Lens files are in references/access-control.md.
When you review a Connect Terraform root, report each item as PASS, FAIL or NOT APPLICABLE:
-target.source_arn, an instance association, and depends_on from the flow.FailedInvocations.max_connections.allowed_account_ids, and the state key and variable file differ per environment.a-pavithraa/aws-serverless-skill
1c28c17
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.