Import By Config File #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Import By Config File | |
on: | |
workflow_dispatch: | |
inputs: | |
config_out_fn: | |
type: string | |
default: "generated_config.tf" | |
environment: | |
type: choice | |
options: | |
- "importer-lbgsandbox" | |
- "importer-tfstaging" | |
default: "importer-tfstaging" | |
jobs: | |
importer: | |
name: "Import-Run" | |
runs-on: ubuntu-latest | |
environment: ${{ inputs.environment }} | |
container: | |
image: ghcr.io/${{ github.repository }}/python_tf:latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
JP_TENANT_NAME: ${{ vars.JP_TENANT_NAME }} | |
JP_CLIENT_ID: ${{ secrets.JP_CLIENT_ID }} | |
JP_CLIENT_SECRET: ${{ secrets.JP_CLIENT_SECRET }} | |
WORKING_DIR: ${{ vars.WORKING_DIR }} | |
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_KEY }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Run Import Utility | |
run: python scripts/import_via_config_file.py | |
- name: Terraform Generate Plan Config | |
run: | | |
cd importer_working_dir/ | |
terraform init | |
terraform fmt | |
cat jamfpro_policy.tf | |
echo "---" | |
cat jamfpro_script.tf | |
terraform plan --generate-config-out="${{ inputs.config_out_fn }}" | |
- name: Commit back to Repo | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Action" | |
git config --global --add safe.directory /__w/terraform-importer-jamfpro/terraform-importer-jamfpro | |
git add importer_working_dir/ | |
git commit -m "Uploading output files" | |
git push | |