Skip to content

Commit 295eec1

Browse files
authored
Merge pull request #49 from oracle-devrel/develop
Automation Toolkit Release v11
2 parents b35d9f2 + 6fcc90a commit 295eec1

File tree

173 files changed

+10429
-2130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+10429
-2130
lines changed

README.md

100644100755
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<li> <a href="/cd3_automation_toolkit/documentation/user_guide/GreenField.md">Green Field Tenancies</a>
3030
<ul>
3131
<li> <a href="/cd3_automation_toolkit/documentation/user_guide/NetworkingScenariosGF.md"</a><b> Must Read :</b> Managing Network for Greenfield Tenancies</li>
32+
<li> <a href="/cd3_automation_toolkit/documentation/user_guide/RemoteExecution.md"</a><b> Must Read :</b> Remote Execution/Cloud Init for OCI compute instances</li>
3233
</ul>
3334
</ul>
3435
</li>
@@ -73,7 +74,7 @@
7374
CD3 stands for <b>C</b>loud <b>D</b>eployment <b>D</b>esign <b>D</b>eliverable.
7475
The CD3 Automation toolkit has been developed to help in automating the OCI resource object management.
7576
<br><br>
76-
It reads input data in the form of CD3 Excel sheet and generates the terraform files which can be used to provision the resources in OCI instead of handling the task through the OCI console manually. The toolkit also reverse engineers the components in OCI back to the Excel sheet and Terraform configuration. This generated Terraform code can be used by the OCI Resource Manager or leveraged by the organisations’ CI/CD processes.
77+
It reads input data in the form of CD3 Excel sheet and generates Terraform files which can be used to provision the resources in OCI instead of handling the task through the OCI console manually. The toolkit also reverse engineers the components in OCI back to the Excel sheet and Terraform configuration. This generated Terraform code can be used by the OCI Resource Manager or leveraged by the organisations’ CI/CD processes.
7778
<br><br>
7879
<kbd>
7980
<img width="748" alt="Screenshot 2022-12-30 at 11 57 41 AM" src="https://user-images.githubusercontent.com/111430850/210614513-5d2e97a6-3c1e-4a2b-a793-3a1b6410c856.png">
@@ -84,15 +85,18 @@ It reads input data in the form of CD3 Excel sheet and generates the terraform f
8485

8586
| OCI Services | Details |
8687
| --------- | ----------- |
87-
| [IAM/Identity](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#iamidentity) | Compartments, Groups, Dynamic Groups, Policies |
88-
| [Network](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#network) | VCNs, Subnets, DRGs, IGWs, NGWs, LPGs, Route Tables, DRG Route, Tables, Security Lists, Network Security Groups, Application Load Balancer, Network Load Balancers |
88+
| [IAM/Identity](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#iamidentity) | Compartments, Groups, Dynamic Groups, Policies, Users, Network Sources |
8989
| [Governance](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#governance) | Tags (Namespaces, Tag Keys, Defined Tags, Default Tags, Cost Tracking) |
90-
| [Compute](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#compute) | Instances – VM, BM, Dedicated VM Hosts |
91-
| [Storage](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#storage) | FSS, Block and Boot Volumes, Backup Policies |
90+
| [Network](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#network) | VCNs, Subnets, VLANs, DRGs, IGWs, NGWs, LPGs, Route Tables, DRG Route, Tables, Security Lists, Network Security Groups, Remote Peering Connections, Application Load Balancer, Network Load Balancers |
91+
| [DNS Management](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#private-dns) | Private DNS - Views, Zones, rrsets/records and Resolvers |
92+
| [Compute](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#compute) | Instances supporting Market Place Images, Remote Exec, Cloud-Init scripts, Dedicated VM Hosts |
93+
| [Storage](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#storage) | FSS, Block and Boot Volumes, Backup Policies, Object Storage Buckets and logging for write events |
9294
| [Database](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#database) | Exa Infra, ExaCS, DB Systems VM and BM, ATP, ADW |
9395
| [Management Services](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#management-services) | Events, Notifications, Alarms, Service Connector Hub (SCH) |
9496
| [Developer Services](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#developer-services) | Resource Manager, Oracle Kubernetes Engine (OKE) |
95-
| [CIS Landing Zone Compliance](/cd3_automation_toolkit/documentation/user_guide/learn_more/CISFeatures.md#additional-cis-compliance-features) | Download and Execute CIS Compliance Check Script, VCN Flow Logs, Cloud Guard, Object Storage, Key Vault, Budget |
97+
| [Logging Services](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#logging-Services) | VCN Flow Logs, LBaaS access and error Logs, OSS Buckets write Logs |
98+
| [SDDCs ](/cd3_automation_toolkit/documentation/user_guide/learn_more/CD3ExcelTabs.md#sddcs-tab) | Oracle Cloud VMWare Solutions |
99+
| [CIS Landing Zone Compliance](/cd3_automation_toolkit/documentation/user_guide/learn_more/CISFeatures.md#additional-cis-compliance-features) | Download and Execute CIS Compliance Check Script, Cloud Guard, Key Vault, Budget |
96100

97101

98102
[Click here](/cd3_automation_toolkit/documentation/user_guide/prerequisites.md) to get started and manage your OCI Infra!

cd3_automation_toolkit/Compute/create_terraform_instances.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ def parse_args():
2424
parser = argparse.ArgumentParser(description='Creates Instances TF file')
2525
parser.add_argument('inputfile', help='Full Path of input CD3 excel file')
2626
parser.add_argument('outdir', help='Output directory for creation of TF files')
27-
parser.add_argument("service_dir",help="subdirectory under region directory in case of separate out directory structure")
27+
parser.add_argument("service_dir",
28+
help="subdirectory under region directory in case of separate out directory structure")
2829
parser.add_argument('prefix', help='TF files prefix')
2930
parser.add_argument('--config', default=DEFAULT_LOCATION, help='Config file name')
3031
return parser.parse_args()
3132

3233

3334
# If input is CD3 excel file
34-
def create_terraform_instances(inputfile, outdir, service_dir,prefix, config):
35+
def create_terraform_instances(inputfile, outdir, service_dir, prefix, config):
3536
boot_policy_tfStr = {}
3637
tfStr = {}
3738
ADS = ["AD1", "AD2", "AD3"]
@@ -60,7 +61,7 @@ def create_terraform_instances(inputfile, outdir, service_dir,prefix, config):
6061
# Take backup of files
6162
for eachregion in ct.all_regions:
6263
resource = sheetName.lower()
63-
srcdir = outdir + "/" + eachregion+ "/" + service_dir + "/"
64+
srcdir = outdir + "/" + eachregion + "/" + service_dir + "/"
6465
commonTools.backup_file(srcdir, resource, auto_tfvars_filename)
6566
tfStr[eachregion] = ''
6667
boot_policy_tfStr[eachregion] = ''
@@ -143,10 +144,12 @@ def create_terraform_instances(inputfile, outdir, service_dir,prefix, config):
143144
vcn_name = subnets.vcn_subnet_map[key][1]
144145
subnet_id = subnets.vcn_subnet_map[key][2]
145146
except Exception as e:
146-
print("Invalid Subnet Name specified for row " + str(i + 3) + ". It Doesnt exist in Subnets sheet. Exiting!!!")
147+
print("Invalid Subnet Name specified for row " + str(
148+
i + 3) + ". It Doesnt exist in Subnets sheet. Exiting!!!")
147149
exit()
148150

149-
tempdict = {'network_compartment_id': commonTools.check_tf_variable(network_compartment_id), 'vcn_name': vcn_name,
151+
tempdict = {'network_compartment_id': commonTools.check_tf_variable(network_compartment_id),
152+
'vcn_name': vcn_name,
150153
'subnet_id': subnet_id}
151154

152155
if columnname == 'Display Name':
@@ -159,6 +162,15 @@ def create_terraform_instances(inputfile, outdir, service_dir,prefix, config):
159162
compartment_var_name = commonTools.check_tf_variable(compartment_var_name)
160163
tempdict = {'compartment_tf_name': compartment_var_name}
161164

165+
if columnname == 'Remote Execute':
166+
if columnvalue != "":
167+
if ("@" in columnvalue):
168+
remote_execute = columnvalue.strip().split("@")
169+
tempdict = {'remote_execute': remote_execute[1],
170+
'bastion_ip': remote_execute[0]}
171+
else:
172+
tempdict = {'remote_execute': columnvalue.strip() }
173+
162174
if columnname == 'Custom Policy Compartment Name':
163175
if columnvalue != "":
164176
custom_policy_compartment_name = columnvalue.strip()
@@ -196,7 +208,7 @@ def create_terraform_instances(inputfile, outdir, service_dir,prefix, config):
196208
if columnname == "SSH Key Var Name":
197209
if columnvalue.strip() != '' and columnvalue.strip().lower() != 'nan':
198210
if "ssh-rsa" in columnvalue.strip():
199-
ssh_key_var_name = "\"" + columnvalue.strip() + "\""
211+
ssh_key_var_name = columnvalue.strip()
200212
else:
201213
ssh_key_var_name = columnvalue.strip()
202214
tempdict = {'ssh_key_var_name': ssh_key_var_name}

cd3_automation_toolkit/Compute/getInitUserCredsforWindows.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

cd3_automation_toolkit/Compute/templates/instances-template

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ instances = {
3232
fault_domain = "{{ fault_domain }}"
3333
{% endif %}
3434

35+
{% if remote_execute %}
36+
remote_execute = "{{ remote_execute }}"
37+
{% endif %}
38+
39+
{% if bastion_ip %}
40+
bastion_ip = "{{ bastion_ip }}"
41+
{% endif %}
42+
43+
{% if cloud_init_script %}
44+
cloud_init_script = "{{ cloud_init_script }}"
45+
{% endif %}
46+
3547
{% if dedicated_vm_host_tf %}
3648
dedicated_vm_host_id = "{{ dedicated_vm_host_tf }}"
3749
{% endif %}
@@ -52,7 +64,7 @@ instances = {
5264
{% endif %}
5365

5466
{% if hostname_label %}
55-
hostname_label = "{{ hostname_label }}"
67+
hostname_label = "{{ hostname_label }}"
5668
{% endif %}
5769

5870
{% if nsg_ids %}
@@ -64,7 +76,7 @@ instances = {
6476
{% endif %}
6577

6678
{% if memory_in_gbs %}
67-
memory_in_gbs = {{ memory_in_gbs }}
79+
memory_in_gbs = {{ memory_in_gbs }}
6880
{% endif %}
6981

7082
{% if capacity_reservation_id %}

cd3_automation_toolkit/Compute/update_instance_nsg.py

Lines changed: 0 additions & 105 deletions
This file was deleted.

cd3_automation_toolkit/Database/export_adb_nonGreenField.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424

2525

2626
def print_adbs(region, vnc_client, adb, values_for_column, ntk_compartment_name):
27-
# def print_exa_infra(region, exa_infra, values_for_column, ntk_compartment_name):
2827
adb_tf_name = commonTools.check_tf_variable(adb.display_name)
29-
# maintenance_window = exa_infra.maintenance_window
3028

3129
adb_subnet_id = adb.subnet_id
3230

@@ -56,7 +54,6 @@ def print_adbs(region, vnc_client, adb, values_for_column, ntk_compartment_name)
5654
whitelisted_ips = whitelisted_ips + "," + ip
5755

5856
whitelisted_ips = whitelisted_ips[1:]
59-
# importCommands[region.lower()].write("\nterraform import oci_database_cloud_exadata_infrastructure." + exa_infra_tf_name + " " + str(exa_infra.id))
6057
importCommands[region.lower()].write(
6158
"\nterraform import \"module.adb[\\\"" + adb_tf_name + "\\\"].oci_database_autonomous_database.autonomous_database\" " + str(adb.id))
6259

0 commit comments

Comments
 (0)