-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring #91
base: master
Are you sure you want to change the base?
Refactoring #91
Changes from 1 commit
0b3d995
ed0b5af
2440d7b
0a47210
ababecb
f906ed5
731e1e6
eb1aebc
84b3b96
5b1d81b
3bc199d
7f48a7b
5f1ae9e
1966a08
dd80317
3baa912
643b820
62dceef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,71 @@ on: | |
|
||
env: | ||
TF_WORKSPACE: gha | ||
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
|
||
jobs: | ||
terraform: | ||
name: 'Terraform Validate and plan' | ||
test_storagerg_module: | ||
name: 'Test and deploy 01_Storage_rg module with Terraform Validate and plan' | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.pull_request.labels.*.name, 'safe-to-test') | ||
|
||
env: | ||
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
|
||
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./01_storage_rg | ||
steps: | ||
# Checkout the repository to the GitHub Actions runner | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
# Install the latest version of Terraform CLI. Enable wrapper for output | ||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_wrapper: true | ||
|
||
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. | ||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
|
||
# Validate config files | ||
- name: Terraform Validate | ||
id: validate | ||
run: terraform validate -no-color | ||
|
||
# Checks that all Terraform configuration files adhere to a canonical format | ||
- name: Terraform Format | ||
id: fmt | ||
run: terraform fmt -recursive -check -list=true | ||
#continue-on-error: true | ||
|
||
# Generates an execution plan for Terraform | ||
- name: Terraform Plan | ||
id: plan | ||
run: terraform plan | ||
#continue-on-error: true | ||
- name: Terraform Apply | ||
id: apply | ||
run: terraform apply -auto-approve | ||
|
||
test_deployhono_module: | ||
name: 'Test 02_deploy_hono module with Terraform Validate and plan' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test deployHono module with validate and plan. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tested this workflow here |
||
needs: test_storagerg_module | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.pull_request.labels.*.name, 'safe-to-test') | ||
|
||
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./02_deployHono | ||
steps: | ||
# Checkout the repository to the GitHub Actions runner | ||
- name: Checkout | ||
|
@@ -61,6 +108,40 @@ jobs: | |
id: plan | ||
run: terraform plan | ||
#continue-on-error: true | ||
|
||
destroy_storagerg_module: | ||
name: 'Destroy 01_Storage_rg module from Azure subscription' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Destroy previously made storagerg |
||
needs: test_deployhono_module | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.pull_request.labels.*.name, 'safe-to-test') | ||
|
||
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./01_storage_rg | ||
steps: | ||
# Checkout the repository to the GitHub Actions runner | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
# Install the latest version of Terraform CLI. Enable wrapper for output | ||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_wrapper: true | ||
|
||
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. | ||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
|
||
- name: Terraform Destroy | ||
id: destroy | ||
run: terraform destroy -auto-approve | ||
|
||
|
||
# TODO | ||
# Make a better output | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workflow now tests and deploys the storagerg module to Azure. Deployhono -module plan would fail because that module needs outputs of storagerg -module shares. Because of this storage_rg needs to be deployed.