-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* allow link to ddos protection plan * added code to azapi update resource * enable ddos protection plan * add var to main module * testing conditional * testing conditional * fix docs and fmt * added new config to resource * fix tags * Update modules/virtualnetwork/variables.tf Co-authored-by: Matt White <[email protected]> * ci: rationalise housekeeping * test: add ddosTest * test: go get --------- Co-authored-by: Pedro Parra Ortega <[email protected]> Co-authored-by: Pedro Parra Ortega <[email protected]>
- Loading branch information
1 parent
d02f03f
commit 170e341
Showing
13 changed files
with
244 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
name: Housekeeping | ||
on: | ||
schedule: | ||
- cron: "11 3 * * *" # daily at 3:11 | ||
workflow_dispatch: | ||
|
||
permissions: | ||
id-token: write | ||
|
||
jobs: | ||
cancelsubscriptions: | ||
name: Cancel subscriptions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Azure login | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
allow-no-subscriptions: true | ||
|
||
- name: Azure cancel subscriptions | ||
uses: azure/CLI@v1 | ||
continue-on-error: true | ||
with: | ||
inlineScript: | | ||
az config set extension.use_dynamic_install=yes_without_prompt | ||
echo "==> Cancelling the following subscriptions:" | ||
az account subscription list | jq -r '.[] | select(.state == "Enabled") | select(.displayName | test("^testdeploy.*")) | .subscriptionId' | ||
az account subscription list | jq -r '.[] | select(.state == "Enabled") | select(.displayName | test("^testdeploy.*")) | .subscriptionId' | xargs -n1 -I% az account subscription cancel --yes --id % | ||
echo "==> Done cancelling subscriptions" | ||
- name: Azure logout | ||
uses: azure/CLI@v1 | ||
if: always() | ||
with: | ||
inlineScript: | | ||
az logout | ||
az cache purge | ||
az account clear | ||
deletealiases: | ||
name: Delete subscription aliases | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Azure login | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
allow-no-subscriptions: true | ||
|
||
- name: Azure delete subscription aliases | ||
uses: azure/CLI@v1 | ||
continue-on-error: true | ||
with: | ||
inlineScript: | | ||
az config set extension.use_dynamic_install=yes_without_prompt | ||
echo "==> Deleting the following subscription aliases:" | ||
az rest --method GET --uri '/providers/Microsoft.Subscription/aliases/?api-version=2021-10-01' | jq -r '.value[] | select(.name | test("^testdeploy")) | .name' | ||
az rest --method GET --uri '/providers/Microsoft.Subscription/aliases/?api-version=2021-10-01' | jq -r '.value[] | select(.name | test("^testdeploy")) | .name' | xargs -n1 -I% az rest --method DELETE --uri '/providers/Microsoft.Subscription/aliases/%?api-version=2021-10-01' | ||
echo "==> Done deleting subscription aliases" | ||
- name: Azure logout | ||
uses: azure/CLI@v1 | ||
if: always() | ||
with: | ||
inlineScript: | | ||
az logout | ||
az cache purge | ||
az account clear | ||
deleteresourcegroups: | ||
name: Delete resource groups | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Azure login | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
allow-no-subscriptions: true | ||
|
||
- name: Azure delete resourcegroups | ||
uses: azure/CLI@v1 | ||
continue-on-error: true | ||
with: | ||
inlineScript: | | ||
echo "==> Deleting the following resource groups:" | ||
az group list | jq -r '.[] | select(.name|test("testdeploy*")) | .name' | ||
az group list | jq -r '.[] | select(.name|test("testdeploy*")) | .name' | xargs -n1 -I% az group delete --yes --name % | ||
echo "==> Done deleting resource groups" | ||
- name: Azure logout | ||
uses: azure/CLI@v1 | ||
if: always() | ||
with: | ||
inlineScript: | | ||
az logout | ||
az cache purge | ||
az account clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.