Skip to content

Commit a006d64

Browse files
authored
Merge pull request #180 from adamrushuk/develop
v1.4.0 release
2 parents 2f1f4f1 + a600dbb commit a006d64

22 files changed

+601
-88
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ env:
5959
TF_PLAN: "tfplan"
6060
TF_VERSION: "0.12.30" # "latest" is supported
6161
TF_WORKING_DIR: ./terraform
62+
# https://github.com/terraform-linters/tflint-ruleset-azurerm/releases
63+
TFLINT_RULESET_AZURERM_VERSION: "v0.8.2"
64+
# https://github.com/terraform-linters/tflint/releases
65+
TFLINT_VERSION: "v0.24.1"
6266

6367
# Env var concatenation is currently not supported at Workflow or Job scope. See workaround below:
6468
# https://github.community/t5/GitHub-Actions/How-can-we-concatenate-multiple-env-vars-at-workflow-and-job/td-p/48489
@@ -139,28 +143,12 @@ jobs:
139143
terraform validate
140144
working-directory: ${{ env.TF_WORKING_DIR }}
141145

142-
# - name: tflint
143-
# uses: reviewdog/[email protected]
144-
# with:
145-
# github_token: ${{ secrets.github_token }}
146-
# working_directory: ${{ env.TF_WORKING_DIR }}
147-
# reporter: github-pr-check # Optional. Change reporter
148-
# fail_on_error: "true" # Optional. Fail action if errors are found
149-
# filter_mode: "nofilter" # Optional. Check all files, not just the diff
150-
# flags: "--module" # Optional. Add custom tflint flags
151-
152-
# - name: Terraform Lint
153-
# uses: rickardl/[email protected]
154-
# with:
155-
# tflint_action_comment: true
156-
# tflint_action_folder: ${{ env.TF_WORKING_DIR }}
157-
# env:
158-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159-
160146
- name: Terraform Lint
161147
run: ./scripts/tflint.sh
162148
env:
163149
TF_WORKING_DIR: ${{ env.TF_WORKING_DIR }}
150+
TFLINT_RULESET_AZURERM_VERSION: ${{ env.TFLINT_RULESET_AZURERM_VERSION }}
151+
TFLINT_VERSION: ${{ env.TFLINT_VERSION }}
164152

165153
- name: Terraform Plan
166154
id: plan
@@ -188,8 +176,8 @@ jobs:
188176
run: ./scripts/wait.sh
189177

190178

179+
# Ansible
191180
# TODO: enable Ansible Lint once this issue has been resolved: https://github.com/ansible/ansible-lint-action/issues/36
192-
# # Ansible
193181
# - name: Lint Ansible Playbook
194182
# uses: ansible/ansible-lint-action@6c8c141
195183
# with:

.github/workflows/destroy.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ jobs:
8989
echo "VELERO_STORAGE_ACCOUNT=${{ env.PREFIX }}stbckuksouth001" >> $GITHUB_ENV
9090
echo "VELERO_STORAGE_RG=${{ env.PREFIX }}-rg-velero-dev-001" >> $GITHUB_ENV
9191
92-
# # Show event info
93-
# - name: Show triggered event data
94-
# run: pwsh -command "./scripts/Get-EventData.ps1"
95-
# env:
96-
# GITHUB_CONTEXT: ${{ toJson(github) }}
97-
9892
# Login
9993
- name: Login to Azure
10094
run: ./scripts/azure_login.sh

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Misc
2-
terraform/.terraform
2+
.terraform
3+
terraform.tfstate*
34
localonly
45
credentials*
56
/temp
67
*.egg-info
8+
*.cer
79

810
# Azure Functions artifacts
911
bin

ansible/site.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
name: docker_repo
4141
- import_role:
4242
name: helm_repo
43-
- import_role:
44-
name: pypi_repo
43+
# - import_role:
44+
# name: pypi_repo
4545
- import_role:
4646
name: raw_repo

function_app/profile.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Remove this if you are not planning on using MSI or Azure PowerShell.
1414
if ($env:MSI_SECRET -and (Get-Module -ListAvailable Az.Accounts)) {
1515
Write-Output "Authenticating PowerShell using Managed Identity..."
16-
# Disable-AzContextAutosave -Scope Process | Out-Null
16+
Disable-AzContextAutosave -Scope Process | Out-Null
1717
Connect-AzAccount -Identity
1818
}
1919
elseif ($env:ARM_TENANT_ID -and $env:ARM_SUBSCRIPTION_ID -and $env:ARM_CLIENT_ID -and $env:ARM_CLIENT_SECRET) {

function_app/requirements.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# See https://aka.ms/functionsmanageddependency for additional information.
33
#
44
@{
5-
# 'Az' = '5.*'
5+
'Az' = '5.*'
66
# Only need Account and Compute cmdlets for VMSS and VM status checks
7-
'Az.Accounts' = '2.*'
8-
'Az.Compute' = '4.*'
7+
# 'Az.Accounts' = '2.*'
8+
# 'Az.Compute' = '4.*'
99
}

scripts/tflint.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
11
#! /usr/bin/env bash
22
#
33
# installs and runs tflint with tflint-ruleset-azurerm plugin
4+
# rules: https://github.com/terraform-linters/tflint-ruleset-azurerm/blob/master/docs/rules/
45

56
# ensure strict mode and predictable failure
67
set -euo pipefail
78
trap "echo 'error: Script failed: see failed command above'" ERR
89

910
# vars
11+
# Set local vars from env var, with default fallbacks
12+
TFLINT_VERSION="${TFLINT_VERSION:-v0.23.1}"
13+
TFLINT_RULESET_AZURERM_VERSION="${TFLINT_RULESET_AZURERM_VERSION:-v0.7.0}"
14+
TF_FLAGS=("$TF_WORKING_DIR")
15+
export TFLINT_LOG=debug
16+
# use empty array to skip adding disabled rules, eg: "DISABLED_RULES=()"
1017
DISABLED_RULES=("azurerm_log_analytics_workspace_invalid_retention_in_days")
1118

12-
message="Downloading tflint and azurerm plugin"
19+
# use dynamic flags
20+
if [ ${#DISABLED_RULES[@]} -gt 0 ]; then
21+
echo "${#DISABLED_RULES[@]} DISABLED_RULES were defined: [${DISABLED_RULES[*]}]."
22+
23+
# repeat flag multiple times
24+
for rule in "${DISABLED_RULES[@]}"; do
25+
echo "Adding [$rule] to flags"
26+
TF_FLAGS+=(--disable-rule="$rule")
27+
done
28+
29+
else
30+
echo "DISABLED_RULES were not defined. Skipping."
31+
fi
32+
33+
message="Downloading tflint ($TFLINT_VERSION) and azurerm plugin ($TFLINT_RULESET_AZURERM_VERSION)"
1334
echo "STARTED: $message..."
1435

1536
# download tflint
16-
curl -L "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" -o tflint.zip && unzip tflint.zip && rm tflint.zip
37+
curl -L "https://github.com/terraform-linters/tflint/releases/download/$TFLINT_VERSION/tflint_linux_amd64.zip" -o tflint.zip && unzip tflint.zip && rm tflint.zip
1738

1839
# download tflint-ruleset-azurerm plugin
19-
curl -L "$(curl -Ls https://api.github.com/repos/terraform-linters/tflint-ruleset-azurerm/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" -o tflint-ruleset-azurerm_linux_amd64.zip && unzip tflint-ruleset-azurerm_linux_amd64.zip && rm tflint-ruleset-azurerm_linux_amd64.zip
40+
curl -L "https://github.com/terraform-linters/tflint-ruleset-azurerm/releases/download/$TFLINT_RULESET_AZURERM_VERSION/tflint-ruleset-azurerm_linux_amd64.zip" -o tflint-ruleset-azurerm_linux_amd64.zip && unzip tflint-ruleset-azurerm_linux_amd64.zip && rm tflint-ruleset-azurerm_linux_amd64.zip
2041

2142
# move tflint-ruleset-azurerm plugin to correct path
2243
install -D -m 777 tflint-ruleset-azurerm ./.tflint.d/plugins/tflint-ruleset-azurerm
@@ -35,5 +56,5 @@ EOF
3556
cat .tflint.hcl
3657

3758
# run tflint
38-
# expand array for disabled rules
39-
TFLINT_LOG=debug ./tflint "$TF_WORKING_DIR" --disable-rule="${DISABLED_RULES[*]}"
59+
echo "Running tflint with the following flags: [${TF_FLAGS[*]}]"
60+
./tflint "${TF_FLAGS[@]}"

terraform/aks.tf

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ resource "azurerm_log_analytics_solution" "aks" {
5454
# https://registry.terraform.io/modules/adamrushuk/aks/azurerm/latest
5555
module "aks" {
5656
source = "adamrushuk/aks/azurerm"
57-
version = "0.4.2"
57+
version = "0.7.0"
5858

5959
kubernetes_version = var.kubernetes_version
6060
location = azurerm_resource_group.aks.location
@@ -67,17 +67,20 @@ module "aks" {
6767

6868
# override defaults
6969
default_node_pool = {
70-
name = var.agent_pool_profile_name
71-
count = var.agent_pool_node_count
72-
# availability_zones = null
73-
vm_size = var.agent_pool_profile_vm_size
74-
enable_auto_scaling = var.agent_pool_enable_auto_scaling
75-
max_count = var.agent_pool_node_max_count
76-
max_pods = 90
77-
min_count = var.agent_pool_node_min_count
78-
os_disk_size_gb = var.agent_pool_profile_disk_size_gb
70+
name = var.agent_pool_profile_name
71+
count = var.agent_pool_node_count
72+
orchestrator_version = var.kubernetes_version
73+
vm_size = var.agent_pool_profile_vm_size
74+
enable_auto_scaling = var.agent_pool_enable_auto_scaling
75+
max_count = var.agent_pool_node_max_count
76+
max_pods = 90
77+
min_count = var.agent_pool_node_min_count
78+
os_disk_size_gb = var.agent_pool_profile_disk_size_gb
7979
}
8080

8181
# add-ons
8282
log_analytics_workspace_id = var.aks_container_insights_enabled == true ? azurerm_log_analytics_workspace.aks[0].id : ""
83+
84+
# Add existing group to the new AKS cluster admin group
85+
aks_admin_group_member_name = var.aks_admins_aad_group_name
8386
}

0 commit comments

Comments
 (0)