Skip to content

Commit 2cf466d

Browse files
Using image OCIDs directly specified in the TF config, not querying using data source. This is based on the new guidelines.
1 parent e97c8eb commit 2cf466d

File tree

9 files changed

+54
-32
lines changed

9 files changed

+54
-32
lines changed

docs/solutions/glusterfs/compute.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resource "oci_core_instance" "GlusterServerInstance" {
33
compartment_id = "${var.compartment_ocid}"
44
display_name = "glusterfs-server1"
55
hostname_label = "glusterfs-server1"
6-
image = "${lookup(data.oci_core_images.ServerImageList.images[0], "id")}"
6+
image = "${var.ServerInstanceImageOCID[var.region]}"
77
shape = "${var.ServerInstanceShape}"
88
subnet_id = "${oci_core_subnet.SubnetAD1.id}"
99
metadata {
@@ -17,7 +17,7 @@ resource "oci_core_instance" "GlusterServerInstance2" {
1717
compartment_id = "${var.compartment_ocid}"
1818
display_name = "glusterfs-server2"
1919
hostname_label = "glusterfs-server2"
20-
image = "${lookup(data.oci_core_images.ServerImageList.images[0], "id")}"
20+
image = "${var.ServerInstanceImageOCID[var.region]}"
2121
shape = "${var.ServerInstanceShape}"
2222
subnet_id = "${oci_core_subnet.SubnetAD2.id}"
2323
metadata {
@@ -31,7 +31,7 @@ resource "oci_core_instance" "GlusterServerInstance3" {
3131
compartment_id = "${var.compartment_ocid}"
3232
display_name = "glusterfs-server3"
3333
hostname_label = "glusterfs-server3"
34-
image = "${lookup(data.oci_core_images.ServerImageList.images[0], "id")}"
34+
image = "${var.ServerInstanceImageOCID[var.region]}"
3535
shape = "${var.ServerInstanceShape}"
3636
subnet_id = "${oci_core_subnet.SubnetAD3.id}"
3737
metadata {
@@ -46,7 +46,7 @@ resource "oci_core_instance" "GlusterClientInstance" {
4646
compartment_id = "${var.compartment_ocid}"
4747
display_name = "glusterfs-client1"
4848
hostname_label = "glusterfs-client1"
49-
image = "${lookup(data.oci_core_images.ClientImageList.images[0], "id")}"
49+
image = "${var.ClientInstanceImageOCID[var.region]}"
5050
shape = "${var.ClientInstanceShape}"
5151
subnet_id = "${oci_core_subnet.SubnetAD1.id}"
5252
metadata {
@@ -60,7 +60,7 @@ resource "oci_core_instance" "GlusterClientInstance2" {
6060
compartment_id = "${var.compartment_ocid}"
6161
display_name = "glusterfs-client2"
6262
hostname_label = "glusterfs-client2"
63-
image = "${lookup(data.oci_core_images.ClientImageList.images[0], "id")}"
63+
image = "${var.ClientInstanceImageOCID[var.region]}"
6464
shape = "${var.ClientInstanceShape}"
6565
subnet_id = "${oci_core_subnet.SubnetAD2.id}"
6666
metadata {
@@ -74,7 +74,7 @@ resource "oci_core_instance" "GlusterClientInstance3" {
7474
compartment_id = "${var.compartment_ocid}"
7575
display_name = "glusterfs-client3"
7676
hostname_label = "glusterfs-client3"
77-
image = "${lookup(data.oci_core_images.ClientImageList.images[0], "id")}"
77+
image = "${var.ClientInstanceImageOCID[var.region]}"
7878
shape = "${var.ClientInstanceShape}"
7979
subnet_id = "${oci_core_subnet.SubnetAD3.id}"
8080
metadata {
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
11
data "oci_identity_availability_domains" "ADs" {
22
compartment_id = "${var.compartment_ocid}"
33
}
4-
5-
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
6-
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
7-
data "oci_core_images" "ServerImageList" {
8-
compartment_id = "${var.compartment_ocid}"
9-
display_name = "${var.ServerInstanceImage}"
10-
}
11-
12-
data "oci_core_images" "ClientImageList" {
13-
compartment_id = "${var.compartment_ocid}"
14-
display_name = "${var.ClientInstanceImage}"
15-
}

docs/solutions/glusterfs/variables.tf

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,26 @@ variable "ClientInstanceShape" {
2424
default = "VM.Standard1.2"
2525
}
2626

27-
variable "ServerInstanceImage" {
28-
default = "CentOS-7-2017.07.17-0"
27+
variable "ClientInstanceImageOCID" {
28+
type = "map"
29+
default = {
30+
// Oracle-provided image "Oracle-Linux-7.4-2017.12.18-0"
31+
// See https://docs.us-phoenix-1.oraclecloud.com/Content/Resources/Assets/OracleProvidedImageOCIDs.pdf
32+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaasc56hnpnx7swoyd2fw5gyvbn3kcdmqc2guiiuvnztl2erth62xnq"
33+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaaxrqeombwty6jyqgk3fraczdd63bv66xgfsqka4ktr7c57awr3p5a"
34+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaayxmzu6n5hsntq4wlffpb4h6qh6z3uskpbm5v3v4egqlqvwicfbyq"
35+
}
2936
}
3037

31-
variable "ClientInstanceImage" {
32-
default = "Oracle-Linux-7.4-2017.10.25-0"
38+
variable "ServerInstanceImageOCID" {
39+
type = "map"
40+
default = {
41+
// Oracle-provided image "CentOS-7-2018.01.04-0"
42+
// See https://docs.us-phoenix-1.oraclecloud.com/Content/Resources/Assets/OracleProvidedImageOCIDs.pdf
43+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaajycoi24gyc4tajpwwxjo63yu76cnhtg5a5cfope4tpalnjnhbjqq"
44+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaafrubf4l6e456z4mqn3bj5dpv3s6czfjmyt2m3ukkugzzaosz2fnq"
45+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt1.aaaaaaaaw2qeuo2g4flwz5uieo7hkt6a5wa7ol2z6y23yeqgixcinxmxg7ja"
46+
}
3347
}
3448

3549
variable "ServerBootStrapFile" {

docs/solutions/omc_monitored_server/chef_stage_and_monitor_instance/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resource "oci_core_instance" "omc_managed_instance" {
77
availability_domain = "${lookup(module.oci_resources.ads[var.ad - 1],"name")}"
88
compartment_id = "${lookup(module.oci_resources.compartments, var.compartment_name)}"
99
display_name = "${var.server_display_name}"
10-
image = "${var.omc_custom_image_id == "notset" ? lookup(module.oci_resources.images, var.image_name) : var.omc_custom_image_id}"
10+
image = "${var.omc_custom_image_id == "notset" ? var.InstanceImageOCID[var.region] : var.omc_custom_image_id}"
1111
shape = "${var.shape_name}"
1212
subnet_id = "${var.subnet_id}"
1313
hostname_label = "${var.hostname}"

docs/solutions/omc_monitored_server/chef_stage_and_monitor_instance/variables.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ variable "shape_name" {
2626
description = "OCI server shape common name, find valid values in the OCI console drop down"
2727
}
2828

29-
variable "image_name" {
30-
description = "OCI server image common name, find valid values in the OCI console drop down"
31-
default = "Oracle-Linux-7.3-2017.05.23-0"
29+
variable "InstanceImageOCID" {
30+
type = "map"
31+
default = {
32+
// Oracle-provided image "Oracle-Linux-7.4-2017.12.18-0"
33+
// See https://docs.us-phoenix-1.oraclecloud.com/Content/Resources/Assets/OracleProvidedImageOCIDs.pdf
34+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaasc56hnpnx7swoyd2fw5gyvbn3kcdmqc2guiiuvnztl2erth62xnq"
35+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaaxrqeombwty6jyqgk3fraczdd63bv66xgfsqka4ktr7c57awr3p5a"
36+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaayxmzu6n5hsntq4wlffpb4h6qh6z3uskpbm5v3v4egqlqvwicfbyq"
37+
}
3238
}
3339

3440
variable "compartment_name" {

docs/solutions/omc_monitored_server/stage_and_monitor_instance/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ resource "oci_core_instance" "omc_managed_instance" {
1414
availability_domain = "${lookup(module.oci_resources.ads[var.ad - 1],"name")}"
1515
compartment_id = "${lookup(module.oci_resources.compartments, var.compartment_name)}"
1616
display_name = "${var.server_display_name}"
17-
image = "${lookup(module.oci_resources.images, var.image_name)}"
17+
image = "${var.InstanceImageOCID[var.region]}"
1818
shape = "${var.shape_name}"
1919
subnet_id = "${var.subnet_id}"
2020
metadata {

docs/solutions/omc_monitored_server/stage_and_monitor_instance/variables.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ variable "shape_name" {
2626
description = "OCI server shape common name, find valid values in the OCI console drop down"
2727
}
2828

29-
variable "image_name" {
30-
description = "OCI server image common name, find valid values in the OCI console drop down"
29+
variable "InstanceImageOCID" {
30+
type = "map"
31+
default = {
32+
// Oracle-provided image "Oracle-Linux-7.4-2017.12.18-0"
33+
// See https://docs.us-phoenix-1.oraclecloud.com/Content/Resources/Assets/OracleProvidedImageOCIDs.pdf
34+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaasc56hnpnx7swoyd2fw5gyvbn3kcdmqc2guiiuvnztl2erth62xnq"
35+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaaxrqeombwty6jyqgk3fraczdd63bv66xgfsqka4ktr7c57awr3p5a"
36+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaayxmzu6n5hsntq4wlffpb4h6qh6z3uskpbm5v3v4egqlqvwicfbyq"
37+
}
3138
}
3239

3340
variable "compartment_name" {

docs/solutions/omc_monitored_server/stage_server/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ resource "oci_core_instance" "omc_managed_instance" {
1414
availability_domain = "${lookup(module.oci_resources.ads[var.ad - 1],"name")}"
1515
compartment_id = "${lookup(module.oci_resources.compartments, var.compartment_name)}"
1616
display_name = "${var.server_display_name}"
17-
image = "${lookup(module.oci_resources.images, var.image_name)}"
17+
image = "${var.InstanceImageOCID[var.region]}"
1818
shape = "${var.shape_name}"
1919
subnet_id = "${var.subnet_id}"
2020
metadata {

docs/solutions/omc_monitored_server/stage_server/variables.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ variable "shape_name" {
2626
description = "OCI server shape common name, find valid values in the OCI console drop down"
2727
}
2828

29-
variable "image_name" {
30-
description = "OCI server image common name, find valid values in the OCI console drop down"
29+
variable "InstanceImageOCID" {
30+
type = "map"
31+
default = {
32+
// Oracle-provided image "Oracle-Linux-7.4-2017.12.18-0"
33+
// See https://docs.us-phoenix-1.oraclecloud.com/Content/Resources/Assets/OracleProvidedImageOCIDs.pdf
34+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaasc56hnpnx7swoyd2fw5gyvbn3kcdmqc2guiiuvnztl2erth62xnq"
35+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaaxrqeombwty6jyqgk3fraczdd63bv66xgfsqka4ktr7c57awr3p5a"
36+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaayxmzu6n5hsntq4wlffpb4h6qh6z3uskpbm5v3v4egqlqvwicfbyq"
37+
}
3138
}
3239

3340
variable "compartment_name" {

0 commit comments

Comments
 (0)