Campaign Agent
Last updated
Last updated
To start using Campaigns, you'll need to set up the Resourcely Campaign Agent, a lightweight Docker container. The agent's primary goal is to continuously fetch your Terraform state files and scan them for guardrail violations and sends the findings back to Resourcely. For the Agent to work, it must have access to your Terraform state file storage.
Currently, only AWS S3 buckets are supported for state file scanning, but support for additional terraform remote states is coming soon.
Resourcely places a high priority on the security of customers' state files. For that reason, the Campaign Agent proxy scanner is designed to operate entirely within the customer's environment. This approach ensures that the state file is scanned locally using the resourcely-cli
, maintaining strict data security. Any findings are securely sent back to Resourcely, without granting direct access to the customer's state file.
Ensure the following egress rules are configured for the container running the agent:
Port 443 to tunnel.<region>.proxy.resourcely.io
(Regions: in
, us
, us-cal-1
, eu
, au
, ap
, jp
).
Port 443 to api.resourcely.io
.
Grant the agent read-only access to the S3 bucket containing your Terraform state file:
s3:GetObject
s3:GetObjectVersion
s3:ListBucket
Alternatively, attach the AWS canned policy AmazonS3ReadOnlyAccess
.
Example Policy:
The Resourcely Campaign agent needs to authenticate with both ngrok and Resourcely. To do so, the following environment variables should be supplied.
The agent requires the following environment variables for authentication. Please contact the Resourcely team to request access to campaigns and securely obtain these, pick option "Request Campaigns Access" :
RESOURCELY_NGROK_EDGE
RESOURCELY_NGROK_TOKEN
RESOURCELY_API_TOKEN
(Generate this in Resourcely: Settings → Generate API Token → CI Runner → Generate Token
)
Next you will have two options to deploy the container, either Kubernetes route or docker-compose:
You can use docker-compose.yml to run the container with the required environment variables and configurations, similar to what’s specified in the Kubernetes deployment.yaml file:
Replace the placeholders in angle brackets (<...>) with your actual values.
Using Docker Compose
Directly with Docker
For all environments that have the campaigns-agent configured, the last piece is to ensure that the source for the state file is associated with the config root in the .resourcely.yaml.
For a config root to be configured for campaigns, it will need to have the following block. If the config root has multiple environments, then it needs this block in each environment, similarly to how context is managed.
Make sure to run "queue scan" when you update your resourcely.yaml file
Once you set everything, you can confirm that campaigns is configured by
Navigate to Metrics → Integrations
.
Confirm all integrations are marked green.
Congratulations! Your next step is to create your First Campaign, and then Remediate Resources!