Library with common functions for Microsoft SDAF deployment automation that help with preparation of 'WORKLOAD-ZONE' tfvars file. Generated file is following example template: https://github.com/Azure/SAP-automation-samples/blob/main/Terraform/WORKSPACES/SYSTEM/LAB-SECE-SAP04-L00/LAB-SECE-SAP04-L00.tfvars
write_tfvars_file(tfvars_file=>'/path/towards/happiness', tfvars_data=>$tfvars_data);
Data provided in $args{tfvars_data} is compiled into tfvars file format and written into target $args{tfvars_file} file located on deployer VM. $args{tfvars_data} is a HASHREF containing individual sections that should be included in final tfvars content. file_header is placed as a comment as a first line of the defined section.
Example: { file_header => "Comment placed on top of the tfvars file", env_definitions => {header => 'Comment placed on top of a section - env_definitions', tfvars_variable_1 = '"value_1"', tfvars_variable_2 = '"value2"'}, workload_networking => {header => 'Comment placed on top of a section - workload_networking', tfvars_variable_boolean = 'true', tfvars_variable_integer = '4'}, }
Results in: Pay attention to double quotes. Only strings are double quoted. Bool and int are not. ### Comment placed on top of the tfvars file
### Comment placed on top of a section - env_definitions tfvars_variable_1 = "value_1" tfvars_variable_2 = "value_2"
### Comment placed on top of a section - env_definitions tfvars_variable_boolean = true tfvars_variable_integer = 4
tfvars_file: Target tfvars file location
tfvars_data: Target tfvars file data - Must be a HASHREF
section_order: Order in which the sections should be compiled into the file - must be an ARRAYREF
compile_tfvars_section($section_data);
Converts HASHREF based tfvars section into terraform format and returns it as a string. Results in: # Header variable_1 = 'value_1' variable_2 = 'value_2'
$section_data: HASHREF containing tfvars section header (comment) and variables
create_workload_tfvars(network_data=>[subnet_a => '192.168.1.0/26', subnet_b => '192.168.1.65/26'],
workload_vnet_code=>'FUN' [, environment=>'LAB', location=>'swedencentral', resource_group=>'Funky', job_id=>'1']);
Function that generates workload zone tfvars content according to arguments and OpenQA variables provided. Content is generated in perl and transformed into tfvars format. File is uploaded into OpenQA format.
environment: SDAF environment. Can be supplied using OpenQA setting 'SDAF_ENV_CODE'
network_data: Network data obtained from `lib/sap_deployment_automation_framework/networking::calculate_subnets`
workload_vnet_code: Workload zone VNET code
define_workload_environment(environment=>'LAB', location=>'swedencentral', resource_group=>'OpenQA');
Returns tfvars environment definitions section in HASHREF format. This section includes various environmental parameters and parameters that do not belong to a specific section. Example: {environment : 'LAB', location : 'swedencentral' ... }
environment: SDAF environment
location: Public cloud location
resource_group: Workload zone resource group
define_networking(workload_vnet_code=>'OpenQA-42', job_id=>'42');
Returns tfvars networking parameter section in HASHREF format. Example: {network_logical_name : 'VNET01', network_name : 'OpenQA-VNET01' ... }
job_id: OpenQA job ID which the deployment belongs to
workload_vnet_code: Workload zone VNET code
define_nat_section(environment=>'LAB', sdaf_region=>'swedencentral', workload_vnet_code=>'OpenQA-42');
Returns tfvars section related to NAT setup in HASHREF format. Example: {nat_gateway_name : 'NAT-01', network_name : 'OpenQA-NAT01' ... }
environment: SDAF environment
sdaf_region: Public cloud location
workload_vnet_code: Public cloud location
define_subnets(network_data=>$network_data);
Returns tfvars section related to subnet setup in HASHREF format. Example: {network_address_space : '192.168.1.0/26', db_subnet_address_prefix : '192.168.1.0/28' ... }
network_data: Network data obtained from `lib/sap_deployment_automation_framework/networking::calculate_subnets`
define_iscsi_devices();
Returns tfvars section related to setup of iSCSI server(s) in HASHREF format. iSCSI is used mostly for SBD based fencing. Example: {iscsi_count : '3', iscsi_useDHCP : 'true' ... }
define_storage_account();
Returns tfvars section related to storage account settings in HASHREF format. Storage accounts related to installation media and SAP transport shares. Example: {install_volume_size : '1024', NFS_provider : 'AFS' ... }