-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (41 loc) · 1.25 KB
/
terraform-pyspark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Deploy and Run PySpark Job on Dataproc
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Authenticate using the correct auth action
- name: Authenticate with Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
# Set up Google Cloud SDK
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: "liqour-store-etl"
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.5.7
- name: Terraform init and validate
run: |
terraform init
terraform validate
- name: Terraform apply
run: |
terraform apply -auto-approve
# Step to upload the PySpark job script from GitHub repo to the GCS bucket
- name: Upload PySpark job to GCS
run: |
gsutil cp main.py gs://liquor-store-bucket/main.py
# Instantiate the Dataproc workflow template
- name: Run Dataproc Workflow Template
run: |
gcloud dataproc workflow-templates instantiate liquor-store-etl-workflow \
--region us-central1