terraform apply registers the integration with Plerion for you. There is no CloudFormation stack in your account, and no role ARN to paste back into the console.
The template registers the integration by calling the Plerion API during
terraform apply. No credential is involved. Plerion verifies the registration by assuming the role the template creates, using your tenant’s external ID.Before you start
- Terraform 1.5.0 or later. The template uses a
checkblock to report a failed registration without blocking the rest of your apply. - Credentials for the target AWS account, with permission to create IAM roles and policies.
- Access to the Plerion console to start onboarding and copy the values the template needs.
Choose how CWPP scanning runs
Plerion enables Cloud Security Posture Management (CSPM) and Cloud Infrastructure Entitlement Management (CIEM) on every integration. Cloud Workload Protection Platform (CWPP) workload scanning is optional, and the Terraform flow provides three templates. Pick the one that matches the CWPP option you select in the console.- Same account (
aws-integration.tf): Plerion runs the CWPP scanning appliances inside the account you are onboarding. The template provisions the appliance role and instance profile. You set the appliance regions and networking in the console after applying. Choose this to keep scanning inside your own account. - Plerion-managed service account (
aws-integration-plerion-managed.tf): Plerion runs the scanning appliances in its own AWS accounts, so there is no appliance infrastructure or networking to manage in your account. You grant a cross-account role to the Plerion service account. See Plerion-managed scanning for how managed scanning works. - Your own service account (
aws-integration-service-account.tf): Plerion runs the scanning appliances in one AWS account you own and nominate, and every account you onboard points at it. Scanning stays inside your organization, and no appliances run in the accounts being scanned. Set that account up first, with the templates in Set up a service account with Terraform.
aws-integration.tf) and set capabilities to CSPM. No CWPP resources are provisioned.
Steps to onboard with Terraform
1
Start an AWS account onboarding in Plerion
- Go to
Settings>Integrations. - Next to AWS account, click the
+button and chooseAdd single AWS account. You can also chooseAdd single AWS account with Terraformto go straight to the Terraform strategy.
2
Select your capabilities
- CSPM and CIEM are selected by default.
- To include workload scanning, also select CWPP.
- Click
Next.
3
Select the Terraform deployment strategy
- On the Deployment strategy step, select Terraform.
- If you selected CWPP, choose whether scanning runs in the same account, through a Plerion-managed service account, or in a service account you own. If you choose your own service account, pick it from the list.
- Click
Next.
4
Download the template
On the Grant Plerion access page, download the Terraform template into its own directory. The file is
aws-integration.tf for same-account scanning, aws-integration-plerion-managed.tf for Plerion-managed scanning, or aws-integration-service-account.tf for scanning in your own service account.5
Copy the values shown in the console
The page lists the values to pass to the template:
plerion_api_urlplerion_account_idtenant_idexternal_idservice_account_id(service account scanning, whether Plerion-managed or your own)
6
Apply the template
From the template directory, initialize and apply, passing the values from the console. For either service account option, also pass
terraform apply provisions the role and policies, then registers the integration with Plerion automatically.-var 'service_account_id=<service_account_id>'. To onboard with CSPM and CIEM only, add -var 'capabilities=CSPM'.7
Finish CWPP setup for same-account scanning
If you chose same-account CWPP, the template provisions the appliance role and instance profile, but the appliance regions and networking are specific to your VPC. In the console, open the integration’s Workload tab, enable the appliance regions, and set the subnet and security group for each region.Neither service account option needs anything further here. Plerion-managed scanning is ready to use, and your own service account already carries its regions from when you set it up.
8
Confirm the integration
The account appears in your integrations list and Plerion starts the first scan. Track progress under
Settings > Integrations > Scans, and view results in the Compliance, Well-Architected, and Findings dashboards.If the account belongs to an AWS organization that no other account in your tenant belongs to, Plerion holds it for approval instead of scanning it. See Account approval.Template inputs
Pass these variables at apply time, or set them in a.tfvars file.
Set up a service account with Terraform
A service account is one AWS account you own that runs the scanning appliances for every account you onboard against it. The appliances stay inside your organization, and the accounts being scanned run no appliances of their own. Set it up before you onboard any account that points at it. Two templates do the work. To get them and the token they need, start adding an AWS account inSettings > Integrations. On Select capabilities, keep CWPP selected, choose Service account, and select Create a Service Account. Then choose Terraform on the step that creates the AWS IAM roles.
1
Grant Plerion access to the service account
Apply Note the
plerion-service-account.tf in the account that will host the appliances. It creates the role Plerion assumes, the role the appliances run as, and its instance profile, then registers the account with Plerion as a service account.plerion_instance_profile_name output. The region template needs it.2
Add a scanning region
Apply The region comes from your AWS provider configuration, so set
plerion-service-account-region.tf once for each region you want to scan in, in the same account, with a separate Terraform state per region. It builds an isolated network for the appliances, an auto-scaling pool that grows and shrinks with the scan queue, and the key their snapshots are encrypted with, then tells Plerion where to find them.AWS_REGION or a provider block to the region you are adding.3
Onboard the accounts you want scanned
Each account is onboarded separately with
aws-integration-service-account.tf, passing this account’s ID as service_account_id. Follow Steps to onboard with Terraform.The appliances do not share a network with your workloads, so the address range the region template creates only has to avoid ranges you peer with. Change it with
vpc_cidr, public_subnet_cidr, and private_subnet_cidr if the defaults overlap something you route to.Service account template inputs
Keeping permissions up to date
Plerion extends the AWS permissions policies over time as detection coverage grows. A CloudFormation stack can update itself, but Terraform manages these resources in your own state, so you apply policy updates yourself. When Plerion releases a policy change, download the current template again and runterraform apply. Terraform updates the role and policies in place. Your integration keeps working on the existing permissions until you apply the update.
If you onboarded before Plerion removed the integration token, your first apply on the current template also needs two variable changes: drop auth_token, which the template no longer declares, and add -var 'tenant_id=<tenant_id>' from the Grant Plerion access page.