-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
31 lines (24 loc) · 827 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
resource "oci_identity_compartment" "main" {
compartment_id = var.oc_compartment_id
description = var.project_name
name = var.project_name
}
resource "oci_core_vcn" "main" {
compartment_id = oci_identity_compartment.main.id
cidr_blocks = [var.vcn_cidr_block]
}
resource "oci_core_subnet" "main" {
count = var.number_of_servers
cidr_block = cidrsubnet(var.vcn_cidr_block, 4, count.index)
compartment_id = oci_identity_compartment.main.id
vcn_id = oci_core_vcn.main.id
}
resource "oci_core_instance" "main" {
count = var.number_of_servers
availability_domain = data.oci_identity_availability_domain.main.name
compartment_id = var.oc_compartment_id
shape = "VM.Standard.E2.1.Micro"
create_vnic_details {
subnet_id = oci_core_subnet.main[count.index].id
}
}