Skip to content

Commit b03f6a3

Browse files
- Initial working free tier resources (arm not tested)
0 parents  commit b03f6a3

File tree

6 files changed

+187
-0
lines changed

6 files changed

+187
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
variables.tf

Diff for: .terraform.lock.hcl

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: main.tf

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
resource "oci_core_virtual_network" "vcn" {
2+
cidr_block = local.vcn_cidr_block
3+
display_name = "AlwaysFreeVCN"
4+
compartment_id = local.compartment_id
5+
}
6+
7+
resource "oci_core_subnet" "subnet" {
8+
cidr_block = local.subnet_cidr_block
9+
display_name = "AlwaysFreeSubnet"
10+
vcn_id = oci_core_virtual_network.vcn.id
11+
availability_domain = local.availability_domain
12+
compartment_id = local.compartment_id
13+
}
14+
15+
resource "oci_core_volume" "block-volume-1" {
16+
availability_domain = local.availability_domain
17+
compartment_id = local.compartment_id
18+
size_in_gbs = 50
19+
}
20+
21+
# resource "oci_core_instance" "instance-1" {
22+
# availability_domain = local.availability_domain
23+
# compartment_id = local.compartment_id
24+
# display_name = local.instance_display_name
25+
# shape = "VM.Standard.A1.Flex"
26+
27+
# shape_config {
28+
# memory_in_gbs = 24
29+
# ocpus = 4
30+
# }
31+
32+
# create_vnic_details {
33+
# subnet_id = oci_core_subnet.subnet.id
34+
# display_name = "arm-vnic"
35+
# assign_public_ip = true
36+
# hostname_label = "arm-free-tier"
37+
# }
38+
39+
# source_details {
40+
# source_type = "image"
41+
# source_id = local.source_id_arm
42+
# boot_volume_size_in_gbs = 50
43+
# }
44+
#
45+
# lifecycle {
46+
# prevent_destroy = true
47+
# }
48+
# }
49+
50+
resource "oci_core_instance" "instance-2" {
51+
availability_domain = local.availability_domain
52+
compartment_id = local.compartment_id
53+
display_name = local.instance_display_name
54+
shape = "VM.Standard.E2.1.Micro"
55+
56+
shape_config {
57+
memory_in_gbs = 1
58+
ocpus = 1
59+
}
60+
61+
create_vnic_details {
62+
subnet_id = oci_core_subnet.subnet.id
63+
display_name = "x86-vnic-1"
64+
assign_public_ip = true
65+
}
66+
67+
source_details {
68+
source_type = "image"
69+
source_id = local.source_id_x86
70+
boot_volume_size_in_gbs = 50
71+
}
72+
}
73+
74+
resource "oci_core_instance" "instance-3" {
75+
availability_domain = local.availability_domain
76+
compartment_id = local.compartment_id
77+
display_name = local.instance_display_name
78+
shape = "VM.Standard.E2.1.Micro"
79+
80+
shape_config {
81+
memory_in_gbs = 1
82+
ocpus = 1
83+
}
84+
85+
create_vnic_details {
86+
subnet_id = oci_core_subnet.subnet.id
87+
display_name = "x86-vnic-2"
88+
assign_public_ip = true
89+
}
90+
91+
source_details {
92+
source_type = "image"
93+
source_id = local.source_id_x86
94+
boot_volume_size_in_gbs = 50
95+
}
96+
}

Diff for: outputs.tf

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# output "public_ip_arm_1" {
2+
# value = oci_core_instance.instance-1.public_ip
3+
# }
4+
5+
output "public_ip_x86_1" {
6+
value = oci_core_instance.instance-2.public_ip
7+
}
8+
9+
output "public_ip_x86_2" {
10+
value = oci_core_instance.instance-3.public_ip
11+
}

Diff for: providers.tf

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
locals {
2+
config = var.toronto
3+
# config = var.hyderabad
4+
# config = var.example_zone
5+
# OCI
6+
tenancy_ocid = local.config.tenancy_ocid
7+
user_ocid = local.config.user_ocid
8+
api_key_fingerprint = local.config.api_key_fingerprint
9+
private_key_path = local.config.private_key_path
10+
region = local.config.region
11+
# Networking
12+
compartment_id = local.config.compartment_id
13+
availability_domain = local.config.availability_domain
14+
vcn_cidr_block = local.config.vcn_cidr_block
15+
subnet_cidr_block = local.config.subnet_cidr_block
16+
# Instance
17+
instance_display_name = local.config.instance_display_name
18+
source_id_arm = local.config.source_id_arm
19+
source_id_x86 = local.config.source_id_x86
20+
}
21+
22+
terraform {
23+
required_providers {
24+
oci = {
25+
source = "oracle/oci"
26+
version = "5.4.0"
27+
}
28+
}
29+
}
30+
31+
provider "oci" {
32+
tenancy_ocid = local.tenancy_ocid
33+
user_ocid = local.user_ocid
34+
fingerprint = local.api_key_fingerprint
35+
private_key_path = local.private_key_path
36+
region = local.region
37+
}

Diff for: variables.example.tf

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
variable "example_zone" {
2+
type = any
3+
default = {
4+
tenancy_ocid = ""
5+
user_ocid = ""
6+
api_key_fingerprint = ""
7+
private_key_path = ""
8+
region = ""
9+
compartment_id = ""
10+
availability_domain = ""
11+
vcn_cidr_block = ""
12+
subnet_cidr_block = ""
13+
instance_display_name = ""
14+
source_id_arm = ""
15+
source_id_x86 = ""
16+
}
17+
}

0 commit comments

Comments
 (0)