Skip to content

Commit 319bb48

Browse files
committed
Automation Toolkit Release v2024.2.2
1 parent 69037cd commit 319bb48

File tree

11 files changed

+39
-18
lines changed

11 files changed

+39
-18
lines changed

cd3_automation_toolkit/Governance/Tagging/templates/tags-defaults-template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tag_defaults = {
2222
compartment_id = "{{ tags.split('=')[1] }}"
2323
value = "{{ tags.split('=')[2] }}"
2424

25-
is_required = {{ tags.split('=')[3] }} #}
25+
is_required = {{ tags.split('=')[3] }}
2626
},
2727
{% endfor %}
2828

cd3_automation_toolkit/Network/BaseNetwork/export_network_nonGreenField.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ def get_rpc_resources(source_region, SOURCE_RPC_LIST, dest_rpc_dict, rpc_source_
300300
dest_drg_rt_name = ""
301301
drg_rt_import_dist_name = ""
302302
dest_drg_rt_import_dist_name = ""
303-
source_rpc_comp_name = ""
304-
dest_rpc_comp_name = ""
303+
source_drg_comp_name = ""
304+
dest_drg_comp_name = ""
305305
dest_rpc_display_name = ""
306306
dest_import_rt_statements = None
307307
import_rt_statements = None
@@ -330,12 +330,13 @@ def get_comp_details(comp_data):
330330

331331
# Check peering is alive
332332
if source_rpc_peer_id is not None and new_rpc.peering_status == "PEERED":
333-
source_rpc_comp_name = get_comp_details(new_rpc.compartment_id)
334333
source_rpc_display_name = new_rpc.display_name
335334
source_rpc_drg_id = new_rpc.drg_id
336335
dest_rpc_id = new_rpc.peer_id
337336
dest_region = new_rpc.peer_region_name.split("-")[1]
338337
source_rpc_drg_name = getattr(rpc_source_client.get_drg(drg_id=source_rpc_drg_id).data, 'display_name')
338+
source_drg_comp_name = get_comp_details(
339+
getattr(rpc_source_client.get_drg(drg_id=source_rpc_drg_id).data, 'compartment_id'))
339340
rpc_tf_name = commonTools.check_tf_variable(new_rpc.display_name)
340341

341342
# Fetch source attach list id
@@ -377,7 +378,7 @@ def get_comp_details(comp_data):
377378
remote_peering_connection_id=source_rpc_peer_id)
378379
dest_rpc_drg_id = dest_rpc.drg_id
379380
dest_rpc_drg_name = getattr(client.get_drg(drg_id=dest_rpc_drg_id).data, 'display_name')
380-
dest_rpc_comp_name = get_comp_details(dest_rpc.compartment_id)
381+
dest_drg_comp_name = get_comp_details(getattr(client.get_drg(drg_id=dest_rpc_drg_id).data, 'compartment_id'))
381382
dest_rpc_display_name = dest_rpc.display_name
382383
dest_drg_rpc_attachment_list = client.list_drg_attachments(
383384
compartment_id=dest_rpc_comp_id, attachment_type="REMOTE_PEERING_CONNECTION",
@@ -412,11 +413,11 @@ def get_comp_details(comp_data):
412413
if col_header == 'Region':
413414
values_for_column[col_header].append(source_region)
414415
elif col_header == 'Attached To':
415-
# Format is RPC::region::dest_rpc_comp_name::dest_rpc_drg_name
416+
# Format is RPC::region::dest_rpc_drg_name
416417
attach_to = "RPC::" + dest_region.lower() + "::" + dest_rpc_drg_name
417418
values_for_column[col_header].append(attach_to)
418419
elif col_header == 'Compartment Name':
419-
values_for_column[col_header].append(source_rpc_comp_name)
420+
values_for_column[col_header].append(source_drg_comp_name)
420421
elif col_header == 'RPC Display Name':
421422
values_for_column[col_header].append(source_rpc_display_name)
422423
elif col_header == 'DRG Name':
@@ -461,11 +462,11 @@ def get_comp_details(comp_data):
461462
if col_header == 'Region':
462463
values_for_column[col_header].append(dest_region.capitalize())
463464
elif col_header == 'Attached To':
464-
# Format is RPC::region::dest_rpc_comp_name::dest_rpc_drg_name
465+
# Format is RPC::region::source_rpc_drg_name
465466
attach_to = "RPC::" + source_region.lower() + "::" + source_rpc_drg_name
466467
values_for_column[col_header].append(attach_to)
467468
elif col_header == 'Compartment Name':
468-
values_for_column[col_header].append(dest_rpc_comp_name)
469+
values_for_column[col_header].append(dest_drg_comp_name)
469470
elif col_header == 'RPC Display Name':
470471
values_for_column[col_header].append(dest_rpc_display_name)
471472
elif col_header == 'DRG Name':

cd3_automation_toolkit/OCI_Regions

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#Region:Region_Key
2-
saltlake:us-saltlake-2
32
amsterdam:eu-amsterdam-1
43
stockholm:eu-stockholm-1
54
abudhabi:me-abudhabi-1

cd3_automation_toolkit/Storage/BlockVolume/templates/blockvolumes-template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ blockvolumes = {
7171
{% endif %}
7272

7373
{% if is_pv_encryption_in_transit_enabled %}
74-
is_pv_encryption_in_transit_enabled = "{{ is_pv_encryption_in_transit_enabled }}"
74+
is_pv_encryption_in_transit_enabled = {{ is_pv_encryption_in_transit_enabled }}
7575
{% endif %}
7676

7777
{% if is_shareable %}

cd3_automation_toolkit/setUpOCI.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,7 @@ def enable_cis_cloudguard(*args,**kwargs):
12621262
region = input("Enter Reporting Region for Cloud Guard eg london: ")
12631263
else:
12641264
region = ct.cg_region
1265+
region = region.lower()
12651266
options = [Option(None, Security.enable_cis_cloudguard, 'Enabling Cloud Guard')]
12661267
execute_options(options, outdir, service_dir_cloud_guard, prefix, ct, region)
12671268
# Update modified path list

cd3_automation_toolkit/user-scripts/createTenancyConfig.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,26 @@ def create_bucket(config, signer):
839839
rewrite_backend.write(new_backend_data)
840840
rewrite_backend.close()
841841

842-
# Manage multiple outdir
842+
# Manage single and multiple outdir
843843
if (outdir_structure_file == '' or outdir_structure_file == "\n"):
844-
pass
844+
#remove depends_on for single outdir
845+
region_dir = terraform_files + "/" + region + "/"
846+
single_outdir_config = configparser.RawConfigParser()
847+
single_outdir_config.read("/cd3user/oci_tools/cd3_automation_toolkit/user-scripts/.outdir_structure_file.properties")
848+
keys = []
849+
for key, val in single_outdir_config.items("Default"):
850+
keys.append(key)
851+
for file in os.listdir(region_dir):
852+
name=file.removesuffix(".tf")
853+
if name in keys:
854+
file=region_dir+"/"+file
855+
with open(file, 'r+') as tf_file:
856+
module_data = tf_file.read().rstrip()
857+
module_data = module_data.replace("# depends_on", "depends_on")
858+
tf_file.close()
859+
f = open(file, "w+")
860+
f.write(module_data)
861+
f.close()
845862
else:
846863
region_dir = terraform_files + "/" + region + "/"
847864
for service, service_dir in outdir_config.items("Default"):

cd3_automation_toolkit/user-scripts/terraform/loadbalancer.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ locals {
3636
}
3737

3838
module "load-balancers" {
39-
# depends_on = [module.vcns, module.subnets] # Uncomment to execute Networking and Load Balancer together
39+
# depends_on = [module.vcns, module.subnets] # Uncomment to execute Networking and Load Balancer together
4040
source = "./modules/loadbalancer/lb-load-balancer"
4141
for_each = var.load_balancers != null ? var.load_balancers : {}
4242

cd3_automation_toolkit/user-scripts/terraform/networkloadbalancer.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ module "nlb-backend-sets" {
7272

7373
module "nlb-backends" {
7474
source = "./modules/networkloadbalancer/nlb-backend"
75+
# depends_on = [module.instances] # Uncomment to create Network and NLBs together
7576
for_each = var.nlb_backends != null ? var.nlb_backends : {}
7677
backend_set_name = merge(module.nlb-backend-sets.*...)[each.value.backend_set_name]["nlb_backend_set_tf_name"]
7778
network_load_balancer_id = length(regexall("ocid1.loadbalancer.oc*", each.value.network_load_balancer_id)) > 0 ? each.value.network_load_balancer_id : merge(module.network-load-balancers.*...)[each.value.network_load_balancer_id]["network_load_balancer_tf_id"]

cd3_automation_toolkit/user-scripts/terraform/sddc.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ data "oci_core_volumes" "ds_volumes" {
5252

5353

5454
data "oci_core_vcns" "oci_vcns_sddc" {
55-
# depends_on = [module.vcns] # Uncomment to create Network and Instances together
55+
# depends_on = [module.vcns] # Uncomment to create Network and SDDC together
5656
for_each = var.sddcs != null ? var.sddcs : {}
5757
compartment_id = each.value.network_compartment_id != null ? (length(regexall("ocid1.compartment.oc*", each.value.network_compartment_id)) > 0 ? each.value.network_compartment_id : var.compartment_ocids[each.value.network_compartment_id]) : var.compartment_ocids[each.value.network_compartment_id]
5858
display_name = each.value.vcn_name
5959
}
6060

6161
data "oci_core_subnets" "oci_subnets_sddc" {
62-
# depends_on = [module.subnets] # Uncomment to create Network and Instances together
62+
# depends_on = [module.subnets] # Uncomment to create Network and SDDC together
6363
for_each = var.sddcs != null ? var.sddcs : {}
6464
compartment_id = each.value.network_compartment_id != null ? (length(regexall("ocid1.compartment.oc*", each.value.network_compartment_id)) > 0 ? each.value.network_compartment_id : var.compartment_ocids[each.value.network_compartment_id]) : var.compartment_ocids[each.value.network_compartment_id]
6565
display_name = each.value.provisioning_subnet_id
@@ -76,7 +76,7 @@ data "oci_core_vlans" "sddc_vlan_id" {
7676

7777

7878
module "sddcs" {
79-
#depends_on = [module.vlans]
79+
# depends_on = [module.vlans] # Uncomment to create Network and SDDC together
8080
source = "./modules/sddc"
8181
for_each = var.sddcs != null ? var.sddcs : {}
8282
compartment_id = each.value.compartment_id != null ? (length(regexall("ocid1.compartment.oc*", each.value.compartment_id)) > 0 ? each.value.compartment_id : var.compartment_ocids[each.value.compartment_id]) : null

jenkins_install/tf-apply.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ pipeline {
216216
} else {
217217
try {
218218
sh '''
219+
set +x
219220
mkdir -p ${WORKSPACE}/../${BUILD_NUMBER}
220221
cd ${WORKSPACE}/../${BUILD_NUMBER}
221222
git clone ${GIT_URL}
@@ -229,6 +230,8 @@ pipeline {
229230
git_status=`git status --porcelain`
230231
if [[ $git_status ]]; then
231232
git commit -m "commit for terraform-apply build - ${BUILD_NUMBER} for "${reg}"/"${service}
233+
git config pull.rebase true
234+
git pull --no-edit origin main
232235
git push origin main
233236
else
234237
echo "Nothing to commit"

0 commit comments

Comments
 (0)