|
5 | 5 | push: |
6 | 6 | branches: |
7 | 7 | - main |
| 8 | + workflow_call: |
| 9 | + inputs: |
| 10 | + aws_endpoint_url_s3: |
| 11 | + type: string |
| 12 | + required: true |
| 13 | + gh_owner: |
| 14 | + type: string |
| 15 | + required: true |
| 16 | + gh_app_id: |
| 17 | + type: string |
| 18 | + required: true |
| 19 | + gh_app_installation_id: |
| 20 | + type: string |
| 21 | + required: true |
| 22 | + path: |
| 23 | + type: string |
| 24 | + required: true |
| 25 | + secrets: |
| 26 | + aws_access_key_id: |
| 27 | + required: true |
| 28 | + aws_secret_access_key: |
| 29 | + required: true |
| 30 | + gh_app_pem_file: |
| 31 | + required: true |
8 | 32 |
|
9 | 33 | env: |
10 | 34 | # S3 backend configuration |
11 | | - AWS_ENDPOINT_URL_S3: ${{ vars.AWS_ENDPOINT_URL_S3 }} |
12 | | - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
13 | | - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 35 | + AWS_ENDPOINT_URL_S3: ${{ inputs.aws_endpoint_url_s3 || vars.AWS_ENDPOINT_URL_S3 }} |
| 36 | + AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id || secrets.AWS_ACCESS_KEY_ID }} |
| 37 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key || secrets.AWS_SECRET_ACCESS_KEY }} |
14 | 38 | # GitHub App configuration |
15 | | - GITHUB_OWNER: ${{ vars.GH_TF_OWNER }} |
16 | | - GITHUB_APP_ID: ${{ vars.GH_TF_APP_ID }} |
17 | | - GITHUB_APP_INSTALLATION_ID: ${{ vars.GH_TF_APP_INSTALLATION_ID }} |
| 39 | + GITHUB_OWNER: ${{ inputs.gh_owner || vars.GH_TF_OWNER }} |
| 40 | + GITHUB_APP_ID: ${{ inputs.gh_app_id || vars.GH_TF_APP_ID }} |
| 41 | + GITHUB_APP_INSTALLATION_ID: ${{ inputs.gh_app_installation_id || vars.GH_TF_APP_INSTALLATION_ID }} |
18 | 42 | GITHUB_APP_PEM_FILE: | |
19 | | - ${{ secrets.GH_TF_APP_PEM_FILE }} |
| 43 | + ${{ secrets.gh_app_pem_file || secrets.GH_TF_APP_PEM_FILE }} |
20 | 44 | # Terraform configuration |
21 | | - TF_WORKSPACE: ${{ vars.GH_TF_OWNER }} |
22 | | - TF_VAR_config: "../test.yaml" |
| 45 | + TF_WORKSPACE: ${{ inputs.gh_owner || vars.GH_TF_OWNER }} |
| 46 | + TF_VAR_config: ${{ inputs.path && format('../config/{0}', inputs.path) || '../test.yaml' }} |
23 | 47 | TF_IN_AUTOMATION: true |
24 | 48 |
|
25 | 49 | defaults: |
|
31 | 55 | name: Terraform Apply |
32 | 56 | runs-on: ubuntu-latest |
33 | 57 | steps: |
34 | | - - name: Checkout the repository |
| 58 | + - name: Checkout the called repository |
35 | 59 | uses: actions/checkout@v6 |
| 60 | + with: |
| 61 | + repository: bruzit/github-organization-as-code |
| 62 | + - name: Checkout the caller repository |
| 63 | + if: github.repository != 'bruzit/github-organization-as-code' |
| 64 | + uses: actions/checkout@v6 |
| 65 | + with: |
| 66 | + path: config |
| 67 | + sparse-checkout: ${{ inputs.path || 'test.yaml' }} |
| 68 | + sparse-checkout-cone-mode: false |
36 | 69 | - name: Set up Terraform |
37 | 70 | uses: hashicorp/setup-terraform@v4 |
38 | 71 | with: |
|
0 commit comments