Skip to content

Commit

Permalink
Terraform updates (#631)
Browse files Browse the repository at this point in the history
* Refactor ANF volume group creation in HDB node module

* Update provider configurations to use version 4.0 or higher

* Refactor ANF volume group creation in HDB node module and update provider configurations

* chore: replace db_scale_out with database_scale_out

* Bump up the version

* Add User creation

* Set permissions on /sapmnt

* Fix capitalization of source in providers.tf

* Refactor NAT Gateway resource properties in outputs.tf

* Refactor azapi provider source in providers.tf

* Refactor private endpoint network policies in subnet resources
* For scaleout use the admin subnet ID

* TF 4.0 support

* For scale out make the admin nic the primary

* Refactor Variable class to remove nullable value property
Update Azure.ResourceManager.Network package to version 1.9.0

* Refactor inventory.tf to support scale-out for SAP system

* Add site information

* Refactor inventory.tf to include scale_out variable

* Refactor vm-hdb.tf to include site information for scale-out databases

* Refactor HANA computer and secondary DNS names for scale-out databases

---------

Co-authored-by: Kimmo Forss <[email protected]>
Co-authored-by: hdamecharla <[email protected]>
  • Loading branch information
3 people authored Sep 13, 2024
1 parent 341dcbe commit de42112
Show file tree
Hide file tree
Showing 45 changed files with 359 additions and 138 deletions.
2 changes: 1 addition & 1 deletion Webapp/SDAF/Models/EnvironmentModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Variables

public class Variable
{
public string? value { get; set; }
public string value { get; set; }
[JsonIgnore]
public bool? isSecret { get; set; }
[JsonIgnore]
Expand Down
2 changes: 1 addition & 1 deletion Webapp/SDAF/SDAFWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PackageReference Include="Azure.ResourceManager" Version="1.13.0" />
<PackageReference Include="Azure.ResourceManager.Compute" Version="1.6.0" />
<PackageReference Include="Azure.ResourceManager.KeyVault" Version="1.3.0" />
<PackageReference Include="Azure.ResourceManager.Network" Version="1.8.0" />
<PackageReference Include="Azure.ResourceManager.Network" Version="1.9.0" />
<PackageReference Include="Azure.ResourceManager.Resources" Version="1.8.0" />
<PackageReference Include="Azure.ResourceManager.Storage" Version="1.3.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.21.2" />
Expand Down
4 changes: 2 additions & 2 deletions deploy/ansible/playbook_04_00_00_db_install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
ansible.builtin.include_role:
name: roles-db/4.0.0-hdb-install
when:
- not db_scale_out
- not database_scale_out

- name: "Database Installation Playbook: - Clear the failed state of hosts"
ansible.builtin.meta: clear_host_errors
Expand All @@ -365,7 +365,7 @@
# ansible.builtin.include_role:
# name: roles-sap-os/2.6-sap-mounts
# when:
# - db_scale_out | default(false) == true
# - database_scale_out | default(false) == true

- name: "Database Installation Playbook: - run HANA Scale-Out installation"
ansible.builtin.include_role:
Expand Down
38 changes: 26 additions & 12 deletions deploy/ansible/playbook_05_01_sap_dbload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
- name: "DBLoad Playbook: - Perform DB Load on HANA"
become: true
become_user: root
when:
- platform == 'HANA'
- "'pas' in supported_tiers"
- ansible_os_family != "Windows"
block:
- name: "DBLoad Playbook: - Setting the dbload facts"
ansible.builtin.set_fact:
Expand All @@ -97,13 +101,6 @@
tags:
- always


- name: "DBLoad Playbook: - Mounting"
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
tags:
- 2.6-sap-mounts

- name: "DBLoad Playbook: Define this SID"
ansible.builtin.set_fact:
this_sid:
Expand All @@ -120,6 +117,28 @@
ansible.builtin.set_fact:
all_sids: "{% if MULTI_SIDS is defined %}{{ MULTI_SIDS }}{% else %}{{ all_sids | default([]) + [this_sid] }}{% endif %}"

- name: Generic Users and Groups for SAP Installation
ansible.builtin.include_role:
name: roles-sap-os/2.5-sap-users
tasks_from: user_nw.yaml
vars:
scs_instance_number: "{{ sid_to_be_deployed.ascs_inst_no }}"
tier: generic
main_password: "{{ hostvars.localhost.sap_password }}"
sapbits_location_base_path: "{{ hostvars.localhost.sapbits_location_base_path }}"
sapbits_sas_token: "{{ hostvars.localhost.sapbits_sas_token }}"
loop: "{{ all_sids }}"
loop_control:
loop_var: sid_to_be_deployed
tags:
- 2.5-sap-users

- name: "DBLoad Playbook: - Mounting"
ansible.builtin.include_role:
name: roles-sap-os/2.6-sap-mounts
tags:
- 2.6-sap-mounts

- name: Run the DBLoad Playbook
block:
- name: "DBLoad Playbook: - Run DBLoad"
Expand Down Expand Up @@ -170,11 +189,6 @@
tags:
- 5.1-dbload

when:
- platform == 'HANA'
- "'pas' in supported_tiers"
- ansible_os_family != "Windows"

# /*----------------------------------------------------------------------------8
# | |
# | Playbook for Oracle DB Load |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@
- node_tier != 'hana'
- sap_mnt is defined

- name: "ANF Mount: Set Permissons on /sapmnt directory"
ansible.builtin.file:
owner: '{{ sidadm_uid }}'
group: sapsys
path: "/sapmnt/{{ sap_sid | upper }}"
state: directory
recurse: true

- name: "ANF Mount: usr/sap/{{ sap_sid | upper }}/SYS"
ansible.posix.mount:
src: "{{ item.src }}"
Expand Down
2 changes: 1 addition & 1 deletion deploy/ansible/vars/ansible-input-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ become_user_name: root
oracle_user_name: oracle
orchestration_ansible_user: azureadm
# ------------------- Begin - SDAF Ansible Version ---------------------------8
SDAF_Version: "3.12.0.0"
SDAF_Version: "3.13.0.0"

# ------------------- End - SDAF Ansible Version ---------------------------8

Expand Down
2 changes: 1 addition & 1 deletion deploy/configs/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12.0.0
3.13.0.0
4 changes: 2 additions & 2 deletions deploy/scripts/New-SDAFDevopsProject.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ControlPlaneSubscriptionName = $Env:SDAF_ControlPlaneSubscriptionName
if ($IsWindows) { $pathSeparator = "\" } else { $pathSeparator = "/" }
#endregion

$versionLabel = "v3.12.0.0"
$versionLabel = "v3.13.0.0"

# az logout

Expand Down Expand Up @@ -1131,4 +1131,4 @@ else {
}


Write-Host "The script has completed" -ForegroundColor Green
Write-Host "The script has completed" -ForegroundColor Green
2 changes: 1 addition & 1 deletion deploy/terraform/bootstrap/sap_deployer/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module "sap_deployer" {
use_service_endpoint = var.use_service_endpoint
use_webapp = var.use_webapp
webapp_client_secret = var.webapp_client_secret
dns_settings = local.dns_settings

}

module "sap_namegenerator" {
Expand Down
9 changes: 4 additions & 5 deletions deploy/terraform/bootstrap/sap_deployer/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ provider "azurerm" {
purge_soft_deleted_certificates_on_destroy = !var.enable_purge_control_for_keyvaults
}
}
skip_provider_registration = true

}

provider "azurerm" {
Expand All @@ -44,15 +44,15 @@ provider "azurerm" {
purge_soft_deleted_certificates_on_destroy = !var.enable_purge_control_for_keyvaults
}
}
skip_provider_registration = true

partner_id = "f94f50f2-2539-42f8-9c8e-c65b28c681f7"
alias = "main"
}

provider "azurerm" {
features {}
subscription_id = try(var.management_dns_subscription_id, null)
skip_provider_registration = true

partner_id = "f94f50f2-2539-42f8-9c8e-c65b28c681f7"
alias = "dnsmanagement"
}
Expand All @@ -61,7 +61,6 @@ provider "azurerm" {
features {}
subscription_id = try(coalesce(var.privatelink_dns_subscription_id, var.management_dns_subscription_id), null)
alias = "privatelinkdnsmanagement"
skip_provider_registration = true
storage_use_azuread = true
}

Expand All @@ -87,7 +86,7 @@ terraform {
}
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.3"
version = ">=4.0"
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions deploy/terraform/bootstrap/sap_library/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ provider "azurerm" {
}

}
skip_provider_registration = true

storage_use_azuread = true
}

Expand All @@ -42,7 +42,7 @@ provider "azurerm" {
tenant_id = local.use_spn ? local.spn.tenant_id : null

alias = "main"
skip_provider_registration = true

storage_use_azuread = true
}

Expand All @@ -51,7 +51,7 @@ provider "azurerm" {
features {
}
alias = "deployer"
skip_provider_registration = true

storage_use_azuread = true
}

Expand All @@ -62,7 +62,7 @@ provider "azurerm" {
client_secret = local.use_spn ? local.spn.client_secret : null
tenant_id = local.use_spn ? local.spn.tenant_id : null
alias = "dnsmanagement"
skip_provider_registration = true

storage_use_azuread = true
}

Expand All @@ -73,7 +73,7 @@ provider "azurerm" {
client_secret = local.use_spn ? local.spn.client_secret : null
tenant_id = local.use_spn ? local.spn.tenant_id : null
alias = "privatelinkdnsmanagement"
skip_provider_registration = true

storage_use_azuread = true
}

Expand Down Expand Up @@ -104,7 +104,7 @@ terraform {
}
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.3"
version = ">=4.0"
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions deploy/terraform/run/sap_deployer/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ provider "azurerm" {
}
}
partner_id = "f94f50f2-2539-42f8-9c8e-c65b28c681f7"
skip_provider_registration = true
storage_use_azuread = !var.shared_access_key_enabled
use_msi = var.use_spn ? false : true
}
Expand All @@ -44,7 +43,6 @@ provider "azurerm" {
}
}
partner_id = "f94f50f2-2539-42f8-9c8e-c65b28c681f7"
skip_provider_registration = true

subscription_id = local.spn.subscription_id
client_id = var.use_spn ? local.spn.client_id : null
Expand All @@ -62,7 +60,6 @@ provider "azurerm" {
client_id = var.use_spn ? local.spn.client_id : null
client_secret = var.use_spn ? local.spn.client_secret: null
tenant_id = var.use_spn ? local.spn.tenant_id: null
skip_provider_registration = true
storage_use_azuread = !var.shared_access_key_enabled
use_msi = var.use_spn ? false : true
}
Expand All @@ -88,7 +85,7 @@ terraform {
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.3"
version = "~> 4.0"
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions deploy/terraform/run/sap_landscape/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ provider "azurerm" {
features {}
subscription_id = length(local.deployer_subscription_id) > 0 ? local.deployer_subscription_id : null
use_msi = var.use_spn ? false : true
skip_provider_registration = true
storage_use_azuread = true
}

Expand All @@ -41,7 +40,7 @@ provider "azurerm" {

partner_id = "25c87b5f-716a-4067-bcd8-116956916dd6"
alias = "workload"
skip_provider_registration = true

}

provider "azurerm" {
Expand All @@ -52,7 +51,7 @@ provider "azurerm" {
client_secret = var.use_spn ? local.cp_spn.client_secret : null
tenant_id = var.use_spn ? local.cp_spn.tenant_id : null
use_msi = var.use_spn ? false : true
skip_provider_registration = true

}


Expand All @@ -68,7 +67,7 @@ provider "azurerm" {
client_secret = var.use_spn ? local.cp_spn.client_secret : null
tenant_id = var.use_spn ? local.cp_spn.tenant_id : null
use_msi = var.use_spn ? false : true
skip_provider_registration = true

}

provider "azurerm" {
Expand All @@ -79,7 +78,7 @@ provider "azurerm" {
client_secret = var.use_spn ? local.cp_spn.client_secret : null
tenant_id = var.use_spn ? local.cp_spn.tenant_id : null
alias = "peering"
skip_provider_registration = true

}

provider "azuread" {
Expand All @@ -90,11 +89,12 @@ provider "azuread" {
}

provider "azapi" {
alias = "api"
subscription_id = local.spn.subscription_id
client_id = local.spn.client_id
client_secret = local.spn.client_secret
tenant_id = local.spn.tenant_id
alias = "api"
subscription_id = local.spn.subscription_id
client_id = var.use_spn ? local.spn.client_id : null
client_secret = var.use_spn ? local.spn.client_secret : null
tenant_id = local.spn.tenant_id
use_msi = var.use_spn ? false : true
}

terraform {
Expand All @@ -118,7 +118,7 @@ terraform {
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.3"
version = ">= 4.0"
}
azapi = {
source = "Azure/azapi"
Expand Down
Loading

0 comments on commit de42112

Please sign in to comment.