Skip to content
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

Refactor/200/tf scenarios updated #214

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2e50a80
cleaned up windows vm create and custom script
Jul 13, 2021
d6047f2
refactored keyvault
Jul 16, 2021
b91c2e7
subnet id for networking module and shared
Jul 16, 2021
9b82340
fixed issues
Jul 16, 2021
3b6ef7c
uncomment ase
Jul 16, 2021
5122681
comment out ase
Jul 16, 2021
297c39f
deployagent fix
Jul 19, 2021
e912f03
cosmetic changes and ase commented out
nabeelp Jul 26, 2021
6f8d044
Add files via upload
kunalbabre Nov 16, 2023
9955c92
Add files via upload
kunalbabre Dec 16, 2023
42c7e34
testing bicep cicd - added new oidc client id for read-only access, t…
JinLee794 Dec 11, 2023
2dc7390
Adding region into the bicep yml, env var and to the what-if arm-depl…
JinLee794 Dec 11, 2023
300ffa4
testing pipeline, adding puysh trigger for this branch
JinLee794 Dec 11, 2023
d3c66b2
testing pipeline, adding puysh trigger for this branch
JinLee794 Dec 11, 2023
edea540
testing with prod id as the what-if scenario requires same level of p…
JinLee794 Dec 11, 2023
c5c059b
testing with prod id as the what-if scenario requires same level of p…
JinLee794 Dec 11, 2023
84f2477
testing the deployment
JinLee794 Dec 11, 2023
fe42bf9
testing the deployment
JinLee794 Dec 11, 2023
c24b57a
testing cicd bicep templates
JinLee794 Dec 28, 2023
950a537
testing cicd
JinLee794 Dec 28, 2023
207e0f1
testing cicd
JinLee794 Dec 28, 2023
2354ea9
testing cicd
JinLee794 Dec 28, 2023
5a2d280
disabling psrule for now
JinLee794 Dec 28, 2023
bc63eff
disabling psrule for now
JinLee794 Dec 28, 2023
f8538b5
consolidating tf scenario 1 workflows into a single cicd pipeline
JinLee794 Jan 2, 2024
6c0fc52
consolidating tf scenario 1 workflows into a single cicd pipeline
JinLee794 Jan 2, 2024
c4bd4c1
consolidating tf scenario 1 workflows into a single cicd pipeline
JinLee794 Jan 2, 2024
458b14a
consolidating tf scenario 1 workflows into a single cicd pipeline
JinLee794 Jan 2, 2024
074eec0
renaming consolidated scenario 1 tf pipeline
JinLee794 Jan 10, 2024
70959e7
Adding concurrency, removed redundant param files
JinLee794 Jan 16, 2024
b86ae52
Adding concurrency, removed redundant param files
JinLee794 Jan 16, 2024
92e6bc7
removing test branch trigger
JinLee794 Jan 16, 2024
55d048b
cleanup
JinLee794 Jan 20, 2024
1cb2704
cleanup
JinLee794 Jan 20, 2024
c18f0d5
wip
JinLee794 Feb 16, 2024
c172460
Functional deployment, further testing required
JinLee794 May 2, 2024
7b99f00
Spoke deployment fixes/cleanup
JinLee794 May 4, 2024
ba24d59
added backend.hcl file
JinLee794 May 4, 2024
021ec67
shared resource group
Jul 13, 2021
2b1767c
cleaned up windows vm create and custom script
Jul 13, 2021
bee64fb
Add files via upload
kunalbabre Nov 16, 2023
5886131
Add files via upload
kunalbabre Dec 16, 2023
c063291
pulling latest
JinLee794 May 29, 2024
7c74280
updating defaults, added to suffix
JinLee794 Jun 19, 2024
645de9e
updating provider, testing e2e deployment
JinLee794 Oct 14, 2024
344d722
precommit
JinLee794 Oct 14, 2024
0dc5223
Resolved merge conflicts, tested tf local
JinLee794 Oct 15, 2024
8093f27
adding rest of changes
JinLee794 Oct 15, 2024
4d89652
minor cleanup for gha
JinLee794 Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/.template.terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
type: string
description: 'Terraform version'
required: true
default: '1.3.9'
default: '1.9.7'
modulePath:
type: string
description: 'Path to the Terraform module'
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/scenario1.terraform.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,91 @@
name: 'Scenario 1: Terraform Multi-Tenant ASEv3 Secure Baseline'

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: false

on:
workflow_dispatch:
inputs:
destroy:
description: 'Destroy resources?'
required: true
type: boolean
default: false

push:
branches:
- main
paths:
- '.github/workflows/scenario1.terraform.yml'
- '.github/workflows/_template.terraform.yml'
- 'scenarios/secure-baseline-multitenant/terraform/**.tf'
- 'scenarios/secure-baseline-multitenant/terraform/**/parameters/ase-multitenant.parameters.tfvars'
- '!scenarios/secure-baseline-multitenant/terraform/**.md'

pull_request:
branches:
- main
paths:
- '.github/workflows/scenario1.terraform.yml'
- '.github/workflows/_template.terraform.yml'
- 'scenarios/secure-baseline-multitenant/terraform/**'
- 'scenarios/secure-baseline-multitenant/terraform/**/parameters/ase-multitenant.parameters.tfvars'
- '!scenarios/secure-baseline-multitenant/terraform/**.md'

permissions:
id-token: write
contents: read
pull-requests: write

env:
modulePath: 'scenarios/secure-baseline-multitenant/terraform'
terraformVersion: 1.5.2 # must be greater than or equal to 1.2 for OIDC
backendStateKey: 'scenario1.hub.tfstate'
tfvarPath: 'parameters/ase-multitenant.parameters.tfvars'

jobs:
prepare-environment:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@main
outputs:
modulePath: ${{ env.modulePath }}
terraformVersion: ${{ env.terraformVersion }}
backendStateKey: ${{ env.backendStateKey }}
tfvarPath: ${{ env.tfvarPath }}

terraform-deploy-hub:
name: 'Terraform CICD (Hub Multi-tenant Secure Baseline)'
needs:
- prepare-environment
uses: ./.github/workflows/.template.terraform.yml
with:
modulePath: ${{ needs.prepare-environment.outputs.modulePath }}/hub
terraformVersion: ${{ needs.prepare-environment.outputs.terraformVersion }}
backendStateKey: 'scenario1.hub.tfstate'
tfvarPath: ${{ needs.prepare-environment.outputs.tfvarPath }}
# Ensure this value is a boolean
destroy: ${{ github.event.inputs.destroy == 'true' }}
secrets: inherit

terraform-deploy-spoke:
name: 'Terraform CICD (Spoke Multi-tenant Secure Baseline)'
needs:
- prepare-environment
- terraform-deploy-hub
uses: ./.github/workflows/.template.terraform.yml
with:
modulePath: ${{ needs.prepare-environment.outputs.modulePath }}/spoke
terraformVersion: ${{ needs.prepare-environment.outputs.terraformVersion }}
backendStateKey: 'scenario1.spoke.tfstate'
tfvarPath: ${{ needs.prepare-environment.outputs.tfvarPath }}
# Ensure this value is a boolean
destroy: ${{ github.event.inputs.destroy == 'true' }}
secrets: inherit
name: 'Scenario 1: Terraform Multi-Tenant ASEv3 Secure Baseline'

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: false
Expand Down
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.74.1 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
rev: v1.96.1 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
hooks:
- id: terraform_fmt
- id: terraform_validate
## Commenting out due to provider mismatch throwing false-positive errors on expected parameters
# - id: terraform_validate
# args:
# - --tf-init-args=-upgrade
# - --hook-config=--retry-once-with-cleanup=true # Boolean. true or false
- id: terraform_docs
args:
- --hook-config=--path-to-file=README.md # Valid UNIX path. I.e. ../TFDOC.md or docs/README.md etc.
Expand Down
100 changes: 100 additions & 0 deletions deployment/bicep/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
targetScope='subscription'
param workloadName string
param location string = deployment().location
@description('The-- environment for which the deployment is being executed')
@allowed([
'dev'
'uat'
'prod'
'dr'
])
param environment string

// parameters for azure devops agent
param vmazdevopsUsername string
param vmazdevopsPassword string
param azureDevOpsAccount string
param personalAccessToken string

// Variables
var resourceSuffix = '${workloadName}-${environment}-${location}-001'
var vmSuffix=environment
// RG Names Declaration
var sharedResourceGroupName = 'rg-shared-${resourceSuffix}'
var aseResourceGroupName = 'rg-ase-${resourceSuffix}'
// Create resources name using these objects and pass it as a params in module
var sharedResourceGroupResources = {
'appInsightsName':'appin-${resourceSuffix}'
'logAnalyticsWorkspaceName': 'logananalyticsws-${resourceSuffix}'
'environmentName': environment
'resourceSuffix' : resourceSuffix
'vmSuffix' : vmSuffix
}



resource aseResourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: aseResourceGroupName
location: location
}



// shared resource group


// for testing -- need a subnet

var NetworkResourceGroupName = 'rg-network-${resourceSuffix}'

resource networkRg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: NetworkResourceGroupName
location: location
}

module vnet_generic './vnettest/vnetWithOutBastian.bicep' = {
name: 'vnet'
scope: resourceGroup(networkRg.name)
params: {
namePrefix: 'test-vnet'
}
}

var subnetId=vnet_generic.outputs.subnetId

// end testing subnet


resource sharedRG 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: sharedResourceGroupName
location: location
}


module shared './shared/shared.bicep' = {
name: 'sharedresources'
scope: resourceGroup(sharedRG.name)
params: {
location: location
sharedResourceGroupResources : sharedResourceGroupResources
subnetId: subnetId
vmazdevopsPassword:vmazdevopsPassword
vmazdevopsUsername: vmazdevopsUsername
personalAccessToken: personalAccessToken
azureDevOpsAccount: azureDevOpsAccount
resourceGroupName: sharedRG.name
}
}

module ase 'ase.bicep' = {
dependsOn: [
shared
]
scope: resourceGroup(aseResourceGroup.name)
name: 'aseresources'
params: {
location: location
workloadName: workloadName
environment: environment
}
}
Loading