diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index 454ef8b..2a785c5 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -44,7 +44,7 @@ env: GITHUB_APP_INSTALLATION_ID: ${{ inputs.gh_app_installation_id || vars.GH_APP_INSTALLATION_ID }} GITHUB_APP_PEM_FILE: ${{ secrets.gh_app_pem_file || secrets.GH_APP_PEM_FILE }} TF_WORKSPACE: ${{ inputs.gh_owner || vars.GH_OWNER }} - TF_VAR_path: ../iac/${{ inputs.path || 'test.yaml' }} + TF_VAR_path: ${{ inputs.path && format('../iac/{0}', inputs.path) || '../test.yaml' }} jobs: terraform: @@ -61,6 +61,7 @@ jobs: repository: 'xebis/github-organization-as-code' - name: Checkout caller YAML configuration + if: github.repository != 'xebis/github-organization-as-code' uses: actions/checkout@v4 with: path: iac diff --git a/.gitignore b/.gitignore index 9152b0a..6240748 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Dotenv files +.env* + # Local .terraform directories **/.terraform/* diff --git a/README.md b/README.md index 0685e2f..d63ad95 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,7 @@ Defaults are the same as in the Terraform provider `github` resource `github_rep Apply the configuration using Terraform: ```shell +# Environment variables export AWS_REGION= export AWS_ENDPOINT_URL_S3= # Only for non-AWS S3 compatible APIs export AWS_ACCESS_KEY_ID= @@ -209,8 +210,9 @@ export GITHUB_APP_INSTALLATION_ID= export GITHUB_APP_PEM_FILE=$(cat ) export TF_WORKSPACE="$GITHUB_OWNER" -export TF_VAR_path="test.yaml" +export TF_VAR_path="../test.yaml" +# Terraform terraform -chdir=terraform init terraform -chdir=terraform plan terraform -chdir=terraform apply