-
Notifications
You must be signed in to change notification settings - Fork 46
99 lines (84 loc) · 2.56 KB
/
cosmosdb-account.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Module:cosmosdb-account
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- '.github/workflows/cosmosdb-account.yml'
- 'terraform/cosmosdb/cosmosdb-account/**'
# - '.github/actions/**'
env:
terraform_workingdir: "terraform/cosmosdb/cosmosdb-account"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
terraform-lint:
name: Run Terraform lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: "${{ env.terraform_workingdir }}"
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: false
terraform-sec:
name: Run Terraform tfsec
needs:
- terraform-lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@main
- name: Run tfsec with reviewdog output on the PR
uses: ./.github/actions/run-terraform-sec
terratest:
name: Run Terratest
needs:
- terraform-sec
runs-on: [self-hosted, 1ES.Pool=azure-data-labs-modules]
environment:
name: acctests
defaults:
run:
working-directory: "${{ env.terraform_workingdir }}/test"
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18.2
- name: Setup Dependencies
run: |
az login --identity > /dev/null
export ARM_USE_MSI=true
export ARM_SUBSCRIPTION_ID=$(az login --identity | jq -r '.[0] | .id')
export ARM_TENANT_ID=$(az login --identity | jq -r '.[0] | .tenantId')
go mod init test && go mod tidy
env:
GOPATH: "/home/cloudtest/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
- name: Unit-test
run: |
az login --identity > /dev/null
export ARM_USE_MSI=true
export ARM_SUBSCRIPTION_ID=$(az login --identity | jq -r '.[0] | .id')
export ARM_TENANT_ID=$(az login --identity | jq -r '.[0] | .tenantId')
go test -v -timeout 45m
env:
GOPATH: "/home/cloudtest/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}"
terraform-docs:
name: Run Terraform Docs
needs:
- terratest
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Render terraform docs and push changes back to PR
uses: ./.github/actions/run-terraform-docs