Infrastructure as Code (IaC) is the practice of provisioning and managing infrastructure resources using code. It is an integral component of DevOps methodology, facilitating the seamless orchestration of applications and their underlying infrastructure such as servers, virtual machines (VMs), databases, and networks.
...
The core of infrastructure provisioning is defining the resources you need for your project, such as virtual machinesVMs, databases, networks, and more. In your IaC code, you describe the desired state of these resources, specifying their attributes, relationships, and configurations.Dinesh Amatya can you provide high-level instructions on how we provision resources in IT-Conductor that is somehow true for all IaC/migration projects regardless of what we are migrating (if possible)?
We leverage Terraform scripts for cloud resource provisioning at IT-Conductor. Specifically, we've crafted a VM-centric Terraform script, which not only provisions virtual machines but also handles the generation and utilization of necessary resources for these VMs. This versatile script has the ability to connect already existing resources like networks, subnets, keys, and security groups or generate them on the fly for provisioning the VM.
The script accepts a JSON configuration file that houses resource information as its input. Below is an example of a simple configuration file designed for provisioning an Azure VM.
Code Block |
---|
{
"infrastructure": {
"region": "westus",
"resource_group": {
"is_existing": "false",
"name": "itc-rg"
},
"vnets": {
"management": {
"is_existing": "true",
"arm_id":"/subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXXX/providers/Microsoft.Network/virtualNetworks/XXXXXXX",
"address_space": "10.200.0.0/16",
"subnet_mgmt": {
"is_existing": "false",
"name": "single-vm-test-subnet",
"prefix": "10.200.10.0/24",
"nsg": {
"is_existing": "false",
"name": "nsg-mgmt-single-vm-test",
"allowed_ips": [
"0.0.0.0/0"
]
}
}
}
}
},
"vms": [
{
"name": "vm1",
"os": {
"publisher": "suse",
"offer": "sles-sap-12-sp5",
"sku": "gen1"
},
"size": "STANDARD_B1s",
"disk_type": "StandardSSD_LRS",
"authentication": {
"type": "key",
"username": "itcuser"
}
}
],
"sshkey": {
"path_to_public_key": "~/.ssh/id_rsa.pub",
"path_to_private_key": "~/.ssh/id_rsa"
}
}
|
In the configuration file, all the fields are self-explanatory. The field is_existing
signifies that the resource already exists. If this value is true, it is used by the script to connect to the VM being provisioned. Otherwise, this resource also gets created from the script itself. Also, the keys are stored in ITC as data files and downloaded to the IT-Conductor Gateway temporarily during the provisioning of the VM.
Explore the following scenarios illustrating resource provisioning during migrations:
...