def generate_terraform_vars_with_folder(): """ Generates the terraform.tfvars file which includes folder structure """ # generate terraform variables from template logger.info("Generating terraform variables with folder structure") cluster_domain = ( f"{config.ENV_DATA.get('cluster_name')}." f"{config.ENV_DATA.get('base_domain')}" ) config.ENV_DATA["cluster_domain"] = cluster_domain # Form the ignition paths bootstrap_ignition_path = os.path.join( config.ENV_DATA["cluster_path"], constants.BOOTSTRAP_IGN ) control_plane_ignition_path = os.path.join( config.ENV_DATA["cluster_path"], constants.MASTER_IGN ) compute_ignition_path = os.path.join( config.ENV_DATA["cluster_path"], constants.WORKER_IGN ) # Update ignition paths to ENV_DATA config.ENV_DATA["bootstrap_ignition_path"] = bootstrap_ignition_path config.ENV_DATA["control_plane_ignition_path"] = control_plane_ignition_path config.ENV_DATA["compute_ignition_path"] = compute_ignition_path # Copy DNS address to vm_dns_addresses config.ENV_DATA["vm_dns_addresses"] = config.ENV_DATA["dns"] # Get the infra ID from metadata.json and update in ENV_DATA metadata_path = os.path.join(config.ENV_DATA["cluster_path"], "metadata.json") metadata_dct = json_to_dict(metadata_path) config.ENV_DATA["folder"] = metadata_dct["infraID"] # expand ssh_public_key_path and update in ENV_DATA ssh_public_key_path = os.path.expanduser(config.DEPLOYMENT["ssh_key"]) config.ENV_DATA["ssh_public_key_path"] = ssh_public_key_path # overwrite RHCOS template # This use-case is mainly used for early RHCOS testing if config.ENV_DATA.get("vm_template_overwrite"): config.ENV_DATA["vm_template"] = config.ENV_DATA["vm_template_overwrite"] create_terraform_var_file("terraform_4_5.tfvars.j2")
def generate_terraform_vars_with_folder(): """ Generates the terraform.tfvars file which includes folder structure """ # generate terraform variables from template logger.info("Generating terraform variables with folder structure") cluster_domain = (f"{config.ENV_DATA.get('cluster_name')}." f"{config.ENV_DATA.get('base_domain')}") config.ENV_DATA['cluster_domain'] = cluster_domain # Form the ignition paths bootstrap_ignition_path = os.path.join(config.ENV_DATA['cluster_path'], constants.BOOTSTRAP_IGN) control_plane_ignition_path = os.path.join(config.ENV_DATA['cluster_path'], constants.MASTER_IGN) compute_ignition_path = os.path.join(config.ENV_DATA['cluster_path'], constants.WORKER_IGN) # Update ignition paths to ENV_DATA config.ENV_DATA['bootstrap_ignition_path'] = bootstrap_ignition_path config.ENV_DATA['control_plane_ignition_path'] = ( control_plane_ignition_path) config.ENV_DATA['compute_ignition_path'] = compute_ignition_path # Copy DNS address to vm_dns_addresses config.ENV_DATA['vm_dns_addresses'] = config.ENV_DATA['dns'] # Get the infra ID from metadata.json and update in ENV_DATA metadata_path = os.path.join(config.ENV_DATA['cluster_path'], "metadata.json") metadata_dct = json_to_dict(metadata_path) config.ENV_DATA['folder'] = metadata_dct['infraID'] # expand ssh_public_key_path and update in ENV_DATA ssh_public_key_path = os.path.expanduser(config.DEPLOYMENT['ssh_key']) config.ENV_DATA['ssh_public_key_path'] = ssh_public_key_path create_terraform_var_file("terraform_4_5.tfvars.j2")