Skip to main content
⏳ Estimated read time: 2 min read

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

FlagDescription
--appstack-nameName of the appStack to be created.
--cloud-providerCloud provider for IaC generation (e.g., aws, gcp, azure).
--componentDefines the components for the appStack (e.g., component1, component2).
--scan-strategyDefines scan strategy: local or repository.
--scanpathPath to the local directory to scan.
--repository-urlURL of the repository to scan for components.
--languageProgramming language of the code (e.g., PYTHON, JAVA).
--container-image-referenceSpecify 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 and component2.

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 and component2.

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.