Skip to content

Commit f7f7362

Browse files
Filter image on display name (#346)
This is temporary fix for issue #345. As noted in each example usage of oci_core_images, the images returned may change over time - a longer term solution is in the works.
1 parent 95f1de9 commit f7f7362

File tree

21 files changed

+57
-96
lines changed

21 files changed

+57
-96
lines changed

data_source_obmcs_core_instances_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ func (s *DatasourceCoreInstanceTestSuite) SetupTest() {
5252
5353
data "oci_core_images" "t" {
5454
compartment_id = "${var.compartment_id}"
55-
operating_system = "Oracle Linux"
56-
operating_system_version = "7.4"
57-
limit = 1
55+
display_name = "Oracle-Linux-7.4-2017.10.25-0"
5856
}
5957
6058
resource "oci_core_instance" "t" {

docs/examples/clusters/Mongodb/datasources.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ data "oci_identity_availability_domains" "ADs" {
33
compartment_id = "${var.tenancy_ocid}"
44
}
55

6-
# Gets the OCID of the OS image to use
6+
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
7+
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
78
data "oci_core_images" "OLImageOCID" {
89
compartment_id = "${var.compartment_ocid}"
9-
operating_system = "${var.InstanceOS}"
10-
operating_system_version = "${var.InstanceOSVersion}"
10+
display_name = "${var.InstanceImageDisplayName}"
1111
}
1212

1313
# Gets a list of vNIC attachments on the bastion host

docs/examples/clusters/Mongodb/variables.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,8 @@ variable "MongoDBShape" {
1717
default = "BM.DenseIO1.36"
1818
}
1919

20-
variable "InstanceOS" {
21-
default = "Oracle Linux"
22-
}
23-
24-
variable "InstanceOSVersion" {
25-
default = "7.4"
20+
variable "InstanceImageDisplayName" {
21+
default = "Oracle-Linux-7.4-2017.10.25-0"
2622
}
2723

2824
variable "VPC-CIDR" {

docs/examples/compute/extended_metadata/extended_metadata.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ data "oci_identity_availability_domains" "ADs" {
2828
compartment_id = "${var.tenancy_ocid}"
2929
}
3030

31-
# Gets the OCID of the OS image to use
31+
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
32+
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
3233
data "oci_core_images" "OLImageOCID" {
3334
compartment_id = "${var.compartment_ocid}"
34-
operating_system = "Oracle Linux"
35-
operating_system_version = "7.4"
35+
display_name = "Oracle-Linux-7.4-2017.10.25-0"
3636
}
3737

3838
# Gets a list of vNIC attachments on the instance

docs/examples/compute/instance/datasources.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ data "oci_identity_availability_domains" "ADs" {
33
compartment_id = "${var.tenancy_ocid}"
44
}
55

6-
# Gets the OCID of the OS image to use
6+
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
7+
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
78
data "oci_core_images" "OLImageOCID" {
89
compartment_id = "${var.compartment_ocid}"
9-
operating_system = "${var.InstanceOS}"
10-
operating_system_version = "${var.InstanceOSVersion}"
10+
display_name = "${var.InstanceImageDisplayName}"
1111
}
1212

1313
# Gets a list of vNIC attachments on the instance

docs/examples/compute/instance/variables.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ variable "InstanceShape" {
1919
default = "VM.Standard1.2"
2020
}
2121

22-
variable "InstanceOS" {
23-
default = "Oracle Linux"
24-
}
25-
26-
variable "InstanceOSVersion" {
27-
default = "7.4"
22+
variable "InstanceImageDisplayName" {
23+
default = "Oracle-Linux-7.4-2017.10.25-0"
2824
}
2925

3026
variable "DBSize" {

docs/examples/compute/instance_lite/instance_lite.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ data "oci_identity_availability_domains" "ADs" {
2727

2828
/* Instances */
2929

30+
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
31+
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
3032
data "oci_core_images" "image-list" {
31-
compartment_id = "${var.compartment_ocid}"
32-
operating_system = "Oracle Linux"
33-
operating_system_version = "7.4"
33+
compartment_id = "${var.compartment_ocid}"
34+
display_name = "Oracle-Linux-7.4-2017.10.25-0"
3435
}
3536

3637
resource "oci_core_instance" "instance1" {

docs/examples/compute/multi_vnic/multi_vnic.tf

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ variable "InstanceShape" {
1919
default = "VM.Standard1.8"
2020
}
2121

22-
variable "InstanceOS" {
23-
default = "Oracle Linux"
24-
}
25-
26-
variable "InstanceOSVersion" {
27-
default = "7.4"
22+
variable "InstanceImageDisplayName" {
23+
default = "Oracle-Linux-7.4-2017.10.25-0"
2824
}
2925

3026
provider "oci" {
@@ -58,11 +54,11 @@ resource "oci_core_subnet" "ExampleSubnet" {
5854
dns_label = "examplesubnet"
5955
}
6056

61-
# Gets the OCID of the OS image to use
57+
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
58+
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
6259
data "oci_core_images" "OLImageOCID" {
6360
compartment_id = "${var.compartment_ocid}"
64-
operating_system = "${var.InstanceOS}"
65-
operating_system_version = "${var.InstanceOSVersion}"
61+
display_name = "${var.InstanceImageDisplayName}"
6662
}
6763

6864
resource "oci_core_instance" "ExampleInstance" {

docs/examples/compute/private_ip/private_ip.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ data "oci_identity_availability_domains" "ADs" {
2929
compartment_id = "${var.tenancy_ocid}"
3030
}
3131

32-
# Gets the OCID of the OS image to use
32+
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
33+
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
3334
data "oci_core_images" "OLImageOCID" {
3435
compartment_id = "${var.compartment_ocid}"
35-
operating_system = "Oracle Linux"
36-
operating_system_version = "7.4"
36+
display_name = "Oracle-Linux-7.4-2017.10.25-0"
3737
}
3838

3939
# Create Instance

docs/examples/load_balancer/lb_full/lb_full.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ resource "oci_core_security_list" "securitylist1" {
120120

121121
/* Instances */
122122

123+
# Gets the OCID of the image. This technique is for example purposes only. The results of oci_core_images may
124+
# change over time for Oracle-provided images, so the only sure way to get the correct OCID is to supply it directly.
123125
data "oci_core_images" "image-list" {
124-
compartment_id = "${var.compartment_ocid}"
125-
operating_system = "Oracle Linux"
126-
operating_system_version = "7.4"
126+
compartment_id = "${var.compartment_ocid}"
127+
display_name = "Oracle-Linux-7.4-2017.10.25-0"
127128
}
128129

129130
resource "oci_core_instance" "instance1" {

0 commit comments

Comments
 (0)