Skip to content

Resourcely-Inc/scaffolding-github-actions-campaigns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resourcely Github Actions Campaigns Scaffolding

Overview

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.

Configuration

.resourcely.yaml Setup

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

IAM Roles for GitHub Actions

To securely connect GitHub Actions to AWS, use IAM roles as described in this AWS blog post.

Assumptions

  • Uses GitHub Actions to run terraform plan and terraform apply.

File Structure

  • 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.

Environments

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.

Setup Guide

Configure Terraform Backend

Terraform state must be stored in a durable backend. Learn more about Terraform backends.

Edit terraform.tf to configure your backend.

Add Resourcely API Token to GitHub Secrets

Update .resourcely.yaml

Ensure .resourcely.yaml correctly reflects the location of Terraform configurations.

Validate Manifest Configuration

Verify that your GitHub Actions workflow contains a valid manifest configuration. View the manifest file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages