generated from NHSDigital/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/dtoss 5412 create azure resources and deployment pipelines in az…
…ure dev ops for team analyses (#54) * DTOSS-5412: Create Azure resource and deployement pipelines * DTOSS-5412: Create Dev Audit root module * PR stuff
- Loading branch information
1 parent
929e1f2
commit f078710
Showing
38 changed files
with
2,229 additions
and
33 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,65 @@ | ||
--- | ||
|
||
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r) | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- main | ||
paths: | ||
include: | ||
- infrastructure/* | ||
|
||
pool: | ||
vmImage: ubuntu-latest | ||
# name: private-pool-dev-uks | ||
|
||
resources: | ||
repositories: | ||
- repository: dtos-devops-templates | ||
type: github | ||
name: NHSDigital/dtos-devops-templates | ||
ref: 6698a57ef95f35661bb668e1b929e6894a554ac6 | ||
endpoint: NHSDigital | ||
|
||
variables: | ||
- group: DEV_audit_backend | ||
- group: DEV_hub_backend_remote_state | ||
- name: TF_DIRECTORY | ||
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-audit | ||
- name: TF_VERSION | ||
value: 1.9.2 | ||
- name: TF_PLAN_ARTIFACT | ||
value: tf_plan_audit_DEV | ||
- name: ENVIRONMENT | ||
value: development | ||
|
||
stages: | ||
- stage: terraform_plan | ||
displayName: Terraform Plan | ||
condition: eq(variables['Build.Reason'], 'Manual') | ||
variables: | ||
tfVarsFile: environments/$(ENVIRONMENT).tfvars | ||
jobs: | ||
- job: init_and_plan | ||
displayName: Init, plan, store artifact | ||
steps: | ||
- checkout: self | ||
- checkout: dtos-devops-templates | ||
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates | ||
|
||
- stage: terraform_apply | ||
displayName: Terraform Apply | ||
dependsOn: [terraform_plan] | ||
condition: and(eq(dependencies.terraform_plan.outputs['init_and_plan.TerraformPlan.changesPresent'], 'true'), eq(variables['Build.Reason'], 'Manual')) | ||
jobs: | ||
- deployment: terraform_apply | ||
displayName: Init, get plan artifact, apply | ||
environment: $(ENVIRONMENT) | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- checkout: self | ||
- checkout: dtos-devops-templates | ||
- template: .azuredevops/templates/steps/tf_apply.yaml@dtos-devops-templates |
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,66 @@ | ||
--- | ||
|
||
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r) | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- main | ||
paths: | ||
include: | ||
- infrastructure/* | ||
|
||
pool: | ||
#vmImage: ubuntu-latest | ||
name: private-pool-dev-uks | ||
|
||
resources: | ||
repositories: | ||
- repository: dtos-devops-templates | ||
type: github | ||
name: NHSDigital/dtos-devops-templates | ||
ref: 6698a57ef95f35661bb668e1b929e6894a554ac6 | ||
endpoint: NHSDigital | ||
|
||
variables: | ||
- group: DEV_core_backend | ||
- group: DEV_audit_backend_remote_state | ||
- group: DEV_hub_backend_remote_state | ||
- name: TF_DIRECTORY | ||
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-core | ||
- name: TF_VERSION | ||
value: 1.9.2 | ||
- name: TF_PLAN_ARTIFACT | ||
value: tf_plan_core_DEV | ||
- name: ENVIRONMENT | ||
value: development | ||
|
||
stages: | ||
- stage: terraform_plan | ||
displayName: Terraform Plan | ||
condition: eq(variables['Build.Reason'], 'Manual') | ||
variables: | ||
tfVarsFile: environments/$(ENVIRONMENT).tfvars | ||
jobs: | ||
- job: init_and_plan | ||
displayName: Init, plan, store artifact | ||
steps: | ||
- checkout: self | ||
- checkout: dtos-devops-templates | ||
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates | ||
|
||
- stage: terraform_apply | ||
displayName: Terraform Apply | ||
dependsOn: [terraform_plan] | ||
condition: and(eq(dependencies.terraform_plan.outputs['init_and_plan.TerraformPlan.changesPresent'], 'true'), eq(variables['Build.Reason'], 'Manual')) | ||
jobs: | ||
- deployment: terraform_apply | ||
displayName: Init, get plan artifact, apply | ||
environment: $(ENVIRONMENT) | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- checkout: self | ||
- checkout: dtos-devops-templates | ||
- template: .azuredevops/templates/steps/tf_apply.yaml@dtos-devops-templates |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[submodule "src/Shared/dotnet-mesh-client"] | ||
# path = src/Shared/dotnet-mesh-client | ||
path = src/Shared/dotnet-mesh-client | ||
url = https://github.com/NHSDigital/dotnet-mesh-client | ||
branch = main |
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
Empty file.
Empty file.
Empty file.
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,15 @@ | ||
module "app_insights_audit" { | ||
for_each = { for key, val in var.regions : key => val if val.is_primary_region } | ||
|
||
source = "../../../dtos-devops-templates/infrastructure/modules/app-insights" | ||
|
||
name = module.regions_config[each.key].names.app-insights | ||
location = each.key | ||
appinsights_type = var.app_insights.appinsights_type | ||
|
||
log_analytics_workspace_id = module.log_analytics_workspace_audit[each.key].id | ||
|
||
resource_group_name = azurerm_resource_group.audit[each.key].name | ||
tags = var.tags | ||
|
||
} |
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,21 @@ | ||
resource "azurerm_resource_group" "audit" { | ||
for_each = { for key, val in var.regions : key => val if val.is_primary_region } | ||
|
||
name = "${module.regions_config[each.key].names.resource-group}-audit" | ||
location = each.key | ||
|
||
lifecycle { | ||
ignore_changes = [tags] | ||
} | ||
} | ||
|
||
module "regions_config" { | ||
for_each = var.regions | ||
|
||
source = "../../../dtos-devops-templates/infrastructure/modules/shared-config" | ||
|
||
location = each.key | ||
application = var.application | ||
env = var.environment | ||
tags = var.tags | ||
} |
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,12 @@ | ||
data "azurerm_client_config" "current" {} | ||
|
||
data "terraform_remote_state" "hub" { | ||
backend = "azurerm" | ||
config = { | ||
subscription_id = var.HUB_SUBSCRIPTION_ID | ||
storage_account_name = var.HUB_BACKEND_AZURE_STORAGE_ACCOUNT_NAME | ||
container_name = var.HUB_BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME | ||
key = var.HUB_BACKEND_AZURE_STORAGE_ACCOUNT_KEY | ||
resource_group_name = var.HUB_BACKEND_AZURE_RESOURCE_GROUP_NAME | ||
} | ||
} |
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,53 @@ | ||
application = "serins" | ||
application_full_name = "service-insights" | ||
environment = "DEV" | ||
|
||
features = { | ||
private_endpoints_enabled = true | ||
private_service_connection_is_manual = false | ||
public_network_access_enabled = false | ||
} | ||
|
||
tags = { | ||
Project = "Service-Insights" | ||
} | ||
|
||
regions = { | ||
uksouth = { | ||
is_primary_region = true | ||
address_space = "10.114.0.0/16" | ||
connect_peering = true | ||
subnets = { | ||
# apps = { | ||
# cidr_newbits = 8 | ||
# cidr_offset = 2 | ||
# delegation_name = "Microsoft.Web/serverFarms" | ||
# service_delegation_name = "Microsoft.Web/serverFarms" | ||
# service_delegation_actions = ["Microsoft.Network/virtualNetworks/subnets/action"] | ||
# } | ||
pep = { | ||
cidr_newbits = 8 | ||
cidr_offset = 1 | ||
} | ||
} | ||
} | ||
} | ||
|
||
app_insights = { | ||
appinsights_type = "web" | ||
} | ||
|
||
law = { | ||
law_sku = "PerGB2018" | ||
retention_days = 30 | ||
} | ||
|
||
storage_accounts = { | ||
fnapp = { | ||
name_suffix = "sqllogs" | ||
account_tier = "Standard" | ||
replication_type = "LRS" | ||
public_network_access_enabled = false | ||
containers = {} | ||
} | ||
} |
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,15 @@ | ||
module "log_analytics_workspace_audit" { | ||
for_each = { for key, val in var.regions : key => val if val.is_primary_region } | ||
|
||
source = "../../../dtos-devops-templates/infrastructure/modules/log-analytics-workspace" | ||
|
||
name = module.regions_config[each.key].names.log-analytics-workspace | ||
location = each.key | ||
|
||
law_sku = var.law.law_sku | ||
retention_days = var.law.retention_days | ||
|
||
resource_group_name = azurerm_resource_group.audit[each.key].name | ||
|
||
tags = var.tags | ||
} |
Oops, something went wrong.