Generate IaC from Multiple Repositories
The command APPCD_GIT_AUTH_TOKEN=$SCM_TOKEN stackgen appstack create
helps generate Infrastructure as Code (IaC) by pulling data from multiple remote repositories. This is useful for consolidating infrastructure components from different repositories into a unified IaC setup.
Usage
APPCD_GIT_AUTH_TOKEN=$SCM_TOKEN stackgen appstack create [flags]
Flags
Flag | Description |
---|---|
--appstack-name | Name of the appStack to be created. |
--cloud-provider | Cloud provider for IaC generation (e.g., aws, gcp, azure). |
--component | Defines the components for the appStack (e.g., component1, component2). |
--scan-strategy | Defines scan strategy: local or repository. |
--scanpath | Path to the local directory to scan. |
--repository-url | URL of the repository to scan for components. |
--language | Programming language of the code (e.g., PYTHON, JAVA). |
--container-image-reference | Specify the container image for scanning components. |
Examples
Usage 1: Create an appStack for AWS
APPCD_GIT_AUTH_TOKEN=$SCM_TOKEN stackgen appstack create --appstack-name my-appstack --cloud-provider aws --component component1,component2
This command will:
- Create an appStack named
my-appstack
for the AWS cloud provider. - Define the components
component1
andcomponent2
.
Usage 2: Create an appStack with multiple repositories
APPCD_GIT_AUTH_TOKEN=$SCM_TOKEN stackgen appstack create --appstack-name my-appstack --cloud-provider gcp --component component1,component2 --scan-strategy repository --repository-url https://github.com/myrepo
This command will:
- Create an appStack named
my-appstack
for GCP. - Use the repository scan strategy and scan the specified repository URL.
- Define the components
component1
andcomponent2
.
Usage 3: Create an appStack with a custom container image
APPCD_GIT_AUTH_TOKEN=$SCM_TOKEN stackgen appstack create --appstack-name my-appstack --cloud-provider aws --component component1 --container-image-reference docker.io/my-container-image
This command will:
- Create an appStack named
my-appstack
for AWS. - Define the component
component1
. - Use the custom container image
docker.io/my-container-image
for scanning the component.