This repository provides a scaffolding to help you start using Resourcely campaigns. It sets up the necessary framework to integrate Resourcely into a repository that uses GitHub Actions with multi-environment as the Terraform runner.
It contains a workflow that runs terraform plan
and then uses the Resourcely GitHub Action to evaluate guardrails on that plan.
For all environments configured with the campaigns-agent, you must ensure that the source for the state file is associated with the config root in .resourcely.yaml
.
For a config root to be configured for campaigns, it requires the following block:
version: "2"
terraform_config_roots:
- name: basic
default_file: main.tf
path: .
skip: false
campaign_config:
state_file_config:
s3:
path: s3://campaigns-terraform-state/terraform.tfstate
To securely connect GitHub Actions to AWS, use IAM roles as described in this AWS blog post.
- Uses GitHub Actions to run
terraform plan
andterraform apply
.
main.tf
: Defines Terraform resources.provider.tf
: Configures Terraform providers.terraform.tf
: Specifies required providers and global settings.vars.tf
: Declares variables used in Terraform configurations.dev.tfvars
/prod.tfvars
: Environment-specific Terraform variables..resourcely.yaml
: Configures Resourcely’s Terraform integration. Learn more.
This scaffolding supports multiple environments using a single config root and *.tfvars
per environment. More details can be found in the Resourcely.yaml Structure documentation.
When creating a Pull Request and selecting the config root (e.g., Resourcely Demo
specified in .resourcely.yaml
), Resourcely will detect and reference those environments in the form. If creating a pull request from a blueprint, you can toggle the "Env" setting and select the versioning_configuration_status
variable to reference values from dev.tfvars
and prod.tfvars
.
Terraform state must be stored in a durable backend. Learn more about Terraform backends.
Edit terraform.tf to configure your backend.
- Generate a new API token in the Resourcely portal.
- Create a GitHub repository secret named
RESOURCELY_API_TOKEN
.
Ensure .resourcely.yaml
correctly reflects the location of Terraform configurations.
Verify that your GitHub Actions workflow contains a valid manifest configuration. View the manifest file.