Skip to content

Commit 15c4406

Browse files
authored
Merge pull request #131 from oracle-devrel/develop
Automation Toolkit Release v2024.4.2
2 parents 8a54274 + 70fc80c commit 15c4406

37 files changed

+782
-177
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<br>
99

10-
[What's New](https://github.com/oracle-devrel/cd3-automation-toolkit/releases/tag/v2024.4.1) &nbsp;&nbsp;[Excel Templates](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/excel-templates/) &nbsp;&nbsp;[CD3 Docs](https://oracle-devrel.github.io/cd3-automation-toolkit/)&nbsp;&nbsp; [Watch & Learn](https://www.youtube.com/playlist?list=PLPIzp-E1msrbJ3WawXVhzimQnLw5iafcp) &nbsp;&nbsp;[Blogs & Tutorials](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/tutorials/) &nbsp;&nbsp;[Livelabs](https://apexapps.oracle.com/pls/apex/f?p=133:180:112501098061930::::wid:3724) &nbsp;&nbsp;[Slack Channel](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/queries)
10+
[What's New](https://github.com/oracle-devrel/cd3-automation-toolkit/releases/tag/v2024.4.2) &nbsp;&nbsp;[Excel Templates](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/excel-templates/) &nbsp;&nbsp;[CD3 Docs](https://oracle-devrel.github.io/cd3-automation-toolkit/)&nbsp;&nbsp; [Watch & Learn](https://www.youtube.com/playlist?list=PLPIzp-E1msrbJ3WawXVhzimQnLw5iafcp) &nbsp;&nbsp;[Blogs & Tutorials](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/tutorials/) &nbsp;&nbsp;[Livelabs](https://apexapps.oracle.com/pls/apex/f?p=133:180:112501098061930::::wid:3724) &nbsp;&nbsp;[Slack Channel](https://oracle-devrel.github.io/cd3-automation-toolkit/latest/queries)
1111

1212
<br>
1313

cd3_automation_toolkit/Database/create_terraform_adb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def create_terraform_adb(inputfile, outdir, service_dir, prefix, ct):
180180
k +=1
181181
else:
182182
wl_str = ""
183-
tempdict = {'whitelisted_ips': wl_str,'network_compartment_id': network_compartment_id, 'vcn_name': vcn_name,
184-
'subnet_id': subnet_id }
183+
#tempdict = {'whitelisted_ips': wl_str,'network_compartment_id': network_compartment_id, 'vcn_name': vcn_name,'subnet_id': subnet_id }
184+
tempdict = {'whitelisted_ips': wl_str }
185185
tempStr.update(tempdict)
186186

187187

cd3_automation_toolkit/Database/templates/adb-template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ adb = {
4343
database_edition = "{{ database_edition }}" #Only for BYOL license model
4444
{% endif %}
4545

46-
{% if data_storage_size_in_tbs == "" %}
46+
{% if data_storage_size_in_tb == "" %}
4747
data_storage_size_in_tbs = {{ data_storage_size_in_tb }}
4848
{% endif %}
4949
db_version = "19c"

cd3_automation_toolkit/Identity/Users/export_users_nonGreenField.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def export_users(inputfile, outdir, service_dir, config, signer, ct,export_domai
112112
domain_name = domain_key.split("@")[1]
113113
domain_client = oci.identity_domains.IdentityDomainsClient(config=config, signer=signer,
114114
service_endpoint=idcs_endpoint)
115-
users = domain_client.list_users()
115+
users = domain_client.list_users(limit=100000) # change this to pagination once api supports
116116
index = 0
117117
for user in users.data.resources:
118118
defined_tags_info = user.urn_ietf_params_scim_schemas_oracle_idcs_extension_oci_tags

cd3_automation_toolkit/Network/BaseNetwork/create_major_objects.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ def create_drg_and_attachments(inputfile, outdir):
243243

244244
if columnname == "DRG Name":
245245
drg_name = columnvalue
246-
drg_tf_name = commonTools.check_tf_variable(drg_name)
246+
if ("ocid1.drg.oc" not in drg_name):
247+
drg_tf_name = commonTools.check_tf_variable(drg_name)
248+
else:
249+
drg_tf_name = drg_name
247250
tempdict['drg_tf_name'] = drg_tf_name
248251

249252
if (columnname == 'Attached To'):
@@ -327,6 +330,8 @@ def create_drg_and_attachments(inputfile, outdir):
327330
#if it is Auto Generated RT(during export) dont attach any RT to DRG attachment
328331
if(columnvalue in commonTools.drg_auto_RTs):
329332
drg_rt_tf_name = ''
333+
elif("ocid1.drgroutetable.oc1" in columnvalue):
334+
drg_rt_tf_name = columnvalue
330335
elif(columnvalue!=''):
331336
drg_rt_tf_name = commonTools.check_tf_variable(drg_name + "_" + columnvalue)
332337
tempStr['drg_rt_tf_name'] = drg_rt_tf_name
@@ -340,7 +345,9 @@ def create_drg_and_attachments(inputfile, outdir):
340345
drgstr_skeleton = drg_template.render(count=0)[:-1]
341346
region_included_drg.append(region)
342347
tempStr['drg_version'] = drg_versions[region, drg_name]
343-
drgstr = drg_template.render(tempStr)
348+
drgstr=''
349+
if ("ocid1.drg.oc" not in drg_tf_name):
350+
drgstr = drg_template.render(tempStr)
344351

345352
if(attachedto=="attached"):
346353
drg_attach = drg_attach_template.render(tempStr)
@@ -360,7 +367,8 @@ def create_drg_and_attachments(inputfile, outdir):
360367
if region in region_included_drg:
361368
if(drg_attach_tfStr[region]!=''):
362369
drg_attach_tfStr[region] = drg_attach_skeleton + drg_attach_tfStr[region]
363-
drg_tfStr[region] = drgstr_skeleton + drg_tfStr[region]
370+
if(drg_tfStr[region] != ''):
371+
drg_tfStr[region] = drgstr_skeleton + drg_tfStr[region]
364372

365373
def processVCN(tempStr):
366374
rt_tf_name = ''

cd3_automation_toolkit/Network/BaseNetwork/create_terraform_route.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def create_terraform_drg_route(inputfile, outdir, service_dir, prefix, ct, non_g
185185
drg_rt_dstrb_tf_name = ''
186186
drg_rt_dstrb_res_name = ''
187187
region = str(df.loc[i, 'Region']).strip()
188-
188+
vcn_connectivity_in_excel = ""
189189
if str(df.loc[i, 'Attached To']).lower().startswith("rpc"):
190190
vcn_connectivity_in_excel = "connectivity"
191191
elif str(df.loc[i, 'Attached To']).lower().startswith("vcn"):
@@ -218,6 +218,9 @@ def create_terraform_drg_route(inputfile, outdir, service_dir, prefix, ct, non_g
218218
# Dont create any route table or route distribution name if using Auto Generated ones
219219
if (DRG_RT in commonTools.drg_auto_RTs and DRG_RD in commonTools.drg_auto_RDs):
220220
continue
221+
# Dont create any oute table or route distribution name if OCID is goven in DRG RT Name
222+
if ("ocid1.drgroutetable.oc" in DRG_RT):
223+
continue
221224

222225
region = region.strip().lower()
223226
if region not in ct.all_regions:

cd3_automation_toolkit/Network/BaseNetwork/exportRoutetable.py

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,39 @@ def get_network_entity_name(config,signer,network_identity_id):
1212
vcn1 = VirtualNetworkClient(config=config, retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY,signer=signer)
1313
if('internetgateway' in network_identity_id):
1414
igw=vcn1.get_internet_gateway(network_identity_id)
15-
network_identity_name = "igw:"+igw.data.display_name
15+
network_entity_comp_id=igw.data.compartment_id
16+
if network_entity_comp_id in export_compartment_ids:
17+
network_identity_name = "igw:"+igw.data.display_name
18+
else:
19+
network_identity_name = "igw:" + igw.data.id
1620
return network_identity_name
1721

1822
elif ('servicegateway' in network_identity_id):
1923
sgw = vcn1.get_service_gateway(network_identity_id)
20-
network_identity_name = "sgw:"+sgw.data.display_name
24+
network_entity_comp_id = sgw.data.compartment_id
25+
if network_entity_comp_id in export_compartment_ids:
26+
network_identity_name = "sgw:" + sgw.data.display_name
27+
else:
28+
network_identity_name = "sgw:"+sgw.data.id
2129
return network_identity_name
2230

2331

2432
elif ('natgateway' in network_identity_id):
2533
ngw = vcn1.get_nat_gateway(network_identity_id)
26-
network_identity_name = "ngw:"+ngw.data.display_name
34+
network_entity_comp_id = ngw.data.compartment_id
35+
if network_entity_comp_id in export_compartment_ids:
36+
network_identity_name = "ngw:" + ngw.data.display_name
37+
else:
38+
network_identity_name = "ngw:"+ngw.data.id
2739
return network_identity_name
2840

2941
elif ('localpeeringgateway' in network_identity_id):
3042
lpg = vcn1.get_local_peering_gateway(network_identity_id)
31-
network_identity_name = "lpg:"+lpg.data.display_name
43+
network_entity_comp_id = lpg.data.compartment_id
44+
if network_entity_comp_id in export_compartment_ids:
45+
network_identity_name = "lpg:" + lpg.data.display_name
46+
else:
47+
network_identity_name = "lpg:"+lpg.data.id
3248
return network_identity_name
3349
elif ('drgattachment' in network_identity_id):
3450
drg_attach = vcn1.get_drg_attachment(network_identity_id)
@@ -46,7 +62,11 @@ def get_network_entity_name(config,signer,network_identity_id):
4662
return network_identity_name
4763
elif ('drg' in network_identity_id):
4864
drg = vcn1.get_drg(network_identity_id)
49-
network_identity_name = "drg:"+drg.data.display_name
65+
network_entity_comp_id = drg.data.compartment_id
66+
if network_entity_comp_id in export_compartment_ids:
67+
network_identity_name = "drg:" + drg.data.display_name
68+
else:
69+
network_identity_name = "drg:"+drg.data.id
5070
return network_identity_name
5171

5272
"""
@@ -282,6 +302,7 @@ def export_routetable(inputfile, outdir, service_dir,config1,signer1, ct, export
282302
config=config1
283303
global signer,tf_or_tofu
284304
signer=signer1
305+
global export_compartment_ids
285306

286307
tf_or_tofu = ct.tf_or_tofu
287308
tf_state_list = [tf_or_tofu, "state", "list"]
@@ -316,6 +337,10 @@ def export_routetable(inputfile, outdir, service_dir,config1,signer1, ct, export
316337
"import_commands_network_routerules.sh")
317338
importCommands[reg] = ''
318339

340+
export_compartment_ids = []
341+
for comp in export_compartments:
342+
export_compartment_ids.append(ct.ntk_compartment_ids[comp])
343+
319344
for reg in export_regions:
320345
config.__setitem__("region", commonTools().region_dict[reg])
321346
state = {'path': f'{outdir}/{reg}/{service_dir}', 'resources': []}

0 commit comments

Comments
 (0)