-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from PerfectThymeTech/marvinbuss/update_azure…
…rm_4 Upgrade azurerm to v4 and update configs
- Loading branch information
Showing
18 changed files
with
361 additions
and
551 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Terraform Destroy Template | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
default: "dev" | ||
description: "Specifies the environment of the deployment." | ||
config: | ||
required: true | ||
type: string | ||
description: "Specifies the configuration folder for the deployment." | ||
terraform_version: | ||
required: true | ||
type: string | ||
description: "Specifies the terraform version." | ||
node_version: | ||
required: true | ||
type: number | ||
description: "Specifies the node version." | ||
working_directory: | ||
required: true | ||
type: string | ||
description: "Specifies the working directory." | ||
tenant_id: | ||
required: true | ||
type: string | ||
description: "Specifies the tenant id of the deployment." | ||
subscription_id: | ||
required: true | ||
type: string | ||
description: "Specifies the subscription id of the deployment." | ||
secrets: | ||
CLIENT_ID: | ||
required: true | ||
description: "Specifies the client id." | ||
MY_SAMPLE_SECRET: | ||
required: true | ||
description: "Specifies a sample secret." | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
deployment: | ||
name: Terraform Destroy | ||
runs-on: [self-hosted] | ||
continue-on-error: false | ||
environment: ${{ inputs.environment }} | ||
if: github.event_name == 'push' || github.event_name == 'release' | ||
concurrency: | ||
group: terraform-${{ inputs.config }}-${{ inputs.environment }} | ||
cancel-in-progress: false | ||
|
||
env: | ||
ARM_TENANT_ID: ${{ inputs.tenant_id }} | ||
ARM_SUBSCRIPTION_ID: ${{ inputs.subscription_id }} | ||
ARM_CLIENT_ID: ${{ secrets.CLIENT_ID }} | ||
ARM_USE_OIDC: true | ||
|
||
steps: | ||
# Setup Node | ||
- name: Setup Node | ||
id: node_setup | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
|
||
# Setup Terraform | ||
- name: Setup Terraform | ||
id: terraform_setup | ||
uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_version: ${{ inputs.terraform_version }} | ||
terraform_wrapper: true | ||
|
||
# Check Out Repository | ||
- name: Check Out Repository | ||
id: checkout_repository | ||
uses: actions/checkout@v4 | ||
|
||
# Terraform Init | ||
- name: Terraform Init | ||
working-directory: ${{ inputs.working_directory }} | ||
run: | | ||
terraform init -backend-config=../../config/${CONFIG}/azurerm.tfbackend | ||
env: | ||
CONFIG: ${{ inputs.config }} | ||
|
||
# Terraform Destroy | ||
- name: Terraform Destroy | ||
working-directory: ${{ inputs.working_directory }} | ||
run: | | ||
terraform apply -var-file="../../config/${CONFIG}/vars.tfvars" -auto-approve -input=false -destroy | ||
env: | ||
CONFIG: ${{ inputs.config }} | ||
TF_VAR_my_secret: ${{ secrets.MY_SAMPLE_SECRET }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module "application_insights" { | ||
source = "github.com/PerfectThymeTech/terraform-azurerm-modules//modules/applicationinsights?ref=main" | ||
providers = { | ||
azurerm = azurerm | ||
} | ||
|
||
location = var.location | ||
resource_group_name = azurerm_resource_group.logging_rg.name | ||
tags = var.tags | ||
application_insights_name = "${local.prefix}-appi001" | ||
application_insights_application_type = "other" | ||
application_insights_log_analytics_workspace_id = var.log_analytics_workspace_id | ||
diagnostics_configurations = [] # local.diagnostics_configurations # Disabled to avoid duplicate logs in LAW and App Insights | ||
} |
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,18 @@ | ||
module "app_service_plan" { | ||
source = "github.com/PerfectThymeTech/terraform-azurerm-modules//modules/appserviceplan?ref=main" | ||
providers = { | ||
azurerm = azurerm | ||
} | ||
|
||
location = var.location | ||
resource_group_name = azurerm_resource_group.app_rg.name | ||
tags = var.tags | ||
service_plan_name = "${local.prefix}-asp001" | ||
service_plan_maximum_elastic_worker_count = null | ||
service_plan_os_type = "Linux" | ||
service_plan_per_site_scaling_enabled = false | ||
service_plan_sku_name = var.function_sku | ||
service_plan_worker_count = 1 # Update to '3' for production | ||
service_plan_zone_balancing_enabled = false # Update to 'true' for production | ||
diagnostics_configurations = local.diagnostics_configurations | ||
} |
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.