Generate IaC with a GitHub Action
This document provides instructions on how to use the StackGen Generative IaC action in a GitHub Action workflow to generate Infrastructure as Code (IaC).
For more details, visit the Generate Action Documentation.
Prerequisites
Before you begin, complete the following setup steps:
-
Sign up for an account on StackGen Visit the StackGen website and create an account.
-
Generate a Personal Access Token (PAT) on StackGen Follow the StackGen documentation to create a new Personal Access Token.
-
Add the Personal Access Token to your repository Store your Personal Access Token as a secret in your GitHub repository with the name
STACKGEN_TOKEN
.
Configuration
The StackGen action can be configured with several inputs to customize the IaC generation process. Below is a summary of the available inputs:
Input | Description | Default Value |
---|---|---|
cloud | Specify the cloud provider (e.g., aws, azure). | aws |
language | Set the programming language (e.g., Python, Java). Default behavior is auto-detection based on file extensions. | auto-detect |
outputDir | Define the output directory for the generated IaC. | ./iac |
scanPath | Indicate the path to scan for the application. | . (current directory) |
targetCompute | Choose the target compute platform (e.g., k8s, ecs). | k8s |
cleanup | Decide whether to clean up the StackGen mothership after the action. | true |
Usage
To use the StackGen Generative IaC action in your GitHub Actions workflow, add the following step to your .github/workflows
YAML file:
- name: Generate IaC
uses: appcd-dev/generate-action@v0
env:
STACKGEN_TOKEN: ${{ secrets.STACKGEN_TOKEN }}
with:
cloud: 'aws' # Specify the cloud provider
language: 'Python' # Set the programming language
outputDir: './iac' # Define the output directory
scanPath: '.' # Indicate the path to scan
targetCompute: 'k8s' # Choose the target compute platform
cleanup: 'true' # Cleanup after action