{"id":22751910,"url":"https://github.com/stackguardian/stackguardian-migrator","last_synced_at":"2026-06-10T11:00:42.082Z","repository":{"id":191448133,"uuid":"684675776","full_name":"StackGuardian/stackguardian-migrator","owner":"StackGuardian","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-01T08:02:56.000Z","size":86,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-11T16:10:06.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StackGuardian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-29T16:18:41.000Z","updated_at":"2023-09-14T09:32:10.000Z","dependencies_parsed_at":"2023-09-15T01:24:01.801Z","dependency_job_id":"31510e78-b462-4a12-b7f1-4c96b17d3b87","html_url":"https://github.com/StackGuardian/stackguardian-migrator","commit_stats":null,"previous_names":["rixhieloomis/transform-bulksg","stackguardian/stackguardian-migrator"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/StackGuardian/stackguardian-migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackGuardian%2Fstackguardian-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackGuardian%2Fstackguardian-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackGuardian%2Fstackguardian-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackGuardian%2Fstackguardian-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StackGuardian","download_url":"https://codeload.github.com/StackGuardian/stackguardian-migrator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackGuardian%2Fstackguardian-migrator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34149132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-11T05:07:53.518Z","updated_at":"2026-06-10T11:00:42.077Z","avatar_url":"https://github.com/StackGuardian.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StackGuardian Migrator\n\nMigrate workloads from other platforms to [StackGuardian Platform](https://app.stackguardian.io).\n\n## Supported platforms for migration\n\n- Terraform Cloud\n\n## Overview\n\n- Extract and transform the workloads from the target platform to StackGuardian Workflows.\n- Review the bulk workflow creation payload.\n- Run sg-cli with the bulk workflow creation payload.\n\n## Prerequisites\n\n- An organization on [StackGuardian Platform](https://app.stackguardian.io)\n- Optionally, pre-configure VCS, cloud integrations or private runners to use when importing into StackGuardian Platform.\n- Terraform\n- [sg-cli](https://github.com/StackGuardian/sg-cli/tree/main/shell)\n\n### Perform terraform login\n\nPerform `terraform login` to ensure that your local Terraform can interact with your Terraform Cloud/Enterprise account.\n\n### Export the resource definitions and Terraform state\n\n- Choose the transformer and locate the example of `terraform.tfvars.example` and rename it to `terraform.tfvars`.\n- Edit terraform.tfvars with appropriate variables.\n- Run the following commands:\n\n```shell\ncd transformer/terraform-cloud\nterraform init\nterraform apply -auto-approve -var-file=terraform.tfvars\n```\n\nA new `export` folder should have been created. The `sg-payload.json` file contains the definition for each workflow that will be created for each Terraform Workspace, and the `states` folder contains the files for the Terraform state for each of your workspaces, if the state export was enabled.\n\nAfter completing the export , edit the `sg-payload.json` file to provide tune each workflow configuration with the following:\n\n### Use the example_payload.jsonc file as a reference and edit the schema of the `sg-payload.json`\n\n- `DeploymentPlatformConfig` - This is used to authenticate against a cloud provider using a StackGuardian Integration. Create the relevant integration in StackGuardian platform and update `DeploymentPlatformConfig.kind` from the following \"AZURE_STATIC\", \"AWS_STATIC\",\"GCP_STATIC\", \"AWS_RBAC\". Update `DeploymentPlatformConfig.config.integrationId` with \"/integrations/INTEGRATION_NAME\" and `DeploymentPlatformConfig.config.profileName` with the name of the integration used upon creation.\n\n```\n  DeploymentPlatformConfig: [\n    {\n      \"kind\": \"AWS_RBAC\",\n      \"config\": {\n        \"integrationId\": \"/integrations/aws-rbac\",\n        \"profileName\": \"default\"\n      }\n    }\n  ]\n```\n\n- `VCSConfig` - Provide full path to the `repo` like as well the relevant `sourceConfigDestKind` from the following \"GITHUB_COM\", \"BITBUCKET_ORG\", \"GITLAB_COM\", \"AZURE_DEVOPS\"\n  - `config.auth`\n  - `config.isPrivate`\n- `ResourceName` - name of your StackGuardian Workflow\n- `wfgrpName` - this corresponds to the labelling of workflow group name in the StackGuardian platform\n- `Description` - description for the workflows created in the StackGuardian platform\n- `Tags` - list of tags for the workflows created in the StackGuardian platform\n- `EnvironmentVariables` - environment variables for the workflows created in the StackGuardian platform\n- `RunnerConstraints` - Runner description for the workflows in the StackGuardian platform\n  - Private runners - ` \n\"RunnerConstraints\": {\n  \"type\": \"private\",\n  \"names\": [\n      \"sg-runner\"\n  ] \n}`\n  - Shared runners - `\n\"RunnerConstraints\": {\n  \"type\": \"shared\"\n}`\n- `Approvers` - Approvers for the workflow to run it successfully\n- `TerraformConfig` - Terraform configuration for the workflows created in the StackGuardian platform\n- `UserSchedules` - Scheduled workflow run configuration for the workflow in the StackGuardian platform\n- `MiniSteps` - Ministeps for the workflow to direct the process if the workflow returns an error/success/approval required and workflow chaining\n\n### Bulk import workflows to StackGuardian Platform\n\n- Fetch [sg-cli](https://github.com/StackGuardian/sg-cli.git) and set it up locally (documentation present in repo)\n- Run the following commands and pass the `sg-payload.json` as payload (represented below)\n- Get your SG API Key here:\n  - Login to Stackguardian.\n  - Go to profile at the bottom left. Click on the eamil or the username.\n  - Click API key and click on view.\n\n```shell\ncd ../../export\n\nexport SG_API_TOKEN=\u003cYOUR_SG_API_TOKEN\u003e\nwget -q \"$(wget -qO- \"https://api.github.com/repos/stackguardian/sg-cli/releases/latest\" | jq -r '.tarball_url')\" -O sg-cli.tar.gz \u0026\u0026 tar -xf sg-cli.tar.gz \u0026\u0026 rm -f sg-cli.tar.gz \u0026\u0026 /bin/cp -rf StackGuardian-sg-cli*/shell/sg-cli . \u0026\u0026 rm -rfd StackGuardian-sg-cli*\n\n./sg-cli workflow create --bulk --org \"\u003cORG NAME\u003e\" -- sg-payload.json\n```\n\nif you want to update a workflow with different details, please re-run the sg-cli command with the modified sg-payload.json and your workflow will be updated with the new details, as long as the ResourceName (Workflow name) remains the same.\n\n```shell\n./sg-cli workflow create --bulk --org \"\u003cORG NAME\u003e\" -- sg-payload.json\n```\n\n## Convert hcl variables to json\n\nHCL variables in terraform cloud appear as strings in sg-payload.json, which needs to be converted to json.\u003c/br \u003e\nIt will change the file input file in place so that none of the other steps need any change.\n\n```shell\n./convert_hcl_to_json.sh \u003cintput_file\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackguardian%2Fstackguardian-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackguardian%2Fstackguardian-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackguardian%2Fstackguardian-migrator/lists"}