Overview
Backline can propose Terraform fixes for cloud misconfigurations and verify supported AWS changes withterraform plan before opening a pull request.
Verification is optional. The two Terraform reader roles are disabled by default in the AWS Cloud integration template. If you do not enable them, Backline can still generate a fix, but it opens a draft pull request pending human approval.
The existing
BacklineCloudIntegrationRole remains part of the AWS Cloud integration. The two optional roles described here add narrowly scoped Terraform state and plan access.Terraform Deployments
Backline treats each Terraform state used by a root module as a separate deployment. A deployment includes:- The repository and root module
- One Terraform state object
- The AWS account that owns the state
- The AWS account managed by that state
- Its execution settings, such as variable files and Terraform version
Optional AWS Roles
The AWS Cloud integration template can create two additional roles:
Both roles:
- Default to disabled
- Trust only Backline’s cloud integration service, using your tenant-specific external ID
- Have fixed names so a request cannot choose another role
- Include explicit permission ceilings that prevent other policies from expanding their access
StateReader Permissions
StateReader is limited to:s3:GetObjectands3:GetObjectVersionfor the configured state objectss3:ListBucketfor the configured state key prefixeskms:Decryptfor the configured KMS keys, when state uses SSE-KMS
StateObjectArns rather than a bucket-wide pattern. The bucket ARN is still required for s3:ListBucket, but the list is restricted to the prefixes you supply.
PlanReader Permissions
PlanReader grants an exact list of read actions for the currently supported AWS resources: DynamoDB tables, security groups, KMS keys, RDS instances, S3 buckets, SNS topics, and SQS queues. Every action is fully qualified; wildcard actions are not allowed, and a check in Backline’s own pipeline rejects them. Backline does not use the normal cloud discovery credential for Terraform plans and never falls back to it when either reader role is unavailable.Supported Scope
Plan verification currently supports:- Terraform state stored in S3
- The AWS provider, plus the local-only
random,null,time, andlocalproviders - One managed AWS account per deployment
- The default Terraform workspace
- Registered variable files and an available Terraform version
Enable Terraform Verification
Update the existingBacklineCloudIntegration CloudFormation stack in each relevant account using the current template:
Template Parameters
The same stack can enable both roles when the state and managed resources are in the same account.
Multiple State Files in One Account
Enable StateReader once and supply all permitted values as comma-separated lists. For example:backline-terraform-reader-parameters.json, then update the stack:
StateKmsKeyArns with every key that encrypts the listed objects.
State and Resources in Different Accounts
Update the stack separately in each account:- Make sure both accounts are connected to Backline through the AWS Cloud integration.
- In the state account, enable StateReader and provide the state object, bucket, prefix, and optional KMS parameters.
- In the managed account, enable PlanReader.
- Use the tenant-specific external ID configured for each account’s AWS Cloud integration.
How Verification Works
- Backline generates the Terraform patch in an AI job that has no cloud credentials.
- Backline takes a fixed snapshot of the active deployments for the root.
- For each supported deployment, the trusted Runner identifies it by deployment ID. It does not supply bucket, state key, account, region, or role coordinates.
- Backline resolves the bucket, state key, region, accounts, and roles from server-side deployment data.
- Backline creates short-lived StateReader and PlanReader sessions for that verifier attempt.
- A separate verifier job, with no AI access, runs the unmodified and modified plans and compares them locally.
- Backline combines the results from every deployment before deciding whether the pull request is ready.
SaaS and On-Premises Runners
In SaaS, Runner requests the short-lived sessions directly from Backline’s credential service. For an on-premises Runner in your VPC, Runner requests them through the authenticated Queue Adapter, which takes the tenant identity from authentication rather than from the request body. In both modes, Backline resolves the deployment settings server-side and provides the credentials only to the verifier job.Pull Request Outcomes
Common reasons for a draft pull request pending human approval include:
- StateReader or PlanReader is not installed
- Terraform state is unavailable or changed during verification
- The root uses a named Terraform workspace
- A deployment spans multiple AWS accounts
- Required variable files or Terraform versions are unavailable
- The root uses an unsupported provider or an executable external data source
- The plan times out or cannot refresh a resource with the allowed read permissions
Troubleshooting
The Pull Request Is a Draft Pending Human Approval
Review the plan status in the pull request. It identifies whether a reader role, state registration, variable file, workspace, provider, or permission prevented verification.StateReader Cannot Read the State
Verify that:- The state object ARN is exact or narrowly matched by
StateObjectArns - The bucket is included in
StateBucketArns StateKeyPrefixescontains the state directory andenv:/*when Terraform enumerates workspaces- Every SSE-KMS key is included in
StateKmsKeyArns - The state account has an AWS Cloud integration using the same external ID