Skip to content

Commit f1a2585

Browse files
committed
Update instances to deprecate hostname_label and subnet_id
1 parent 900e45f commit f1a2585

File tree

10 files changed

+42
-20
lines changed

10 files changed

+42
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
### Added
44
- Support for Oracle Digital Assistant
55

6+
### Deprecated
7+
- Instances: The `hostname_label` and `subnet_id` attributes are now deprecated. Please use the `hostname_label` and `subnet_id` attributes under `create_vnic_details`.
8+
69
### Fixed
710
- Update for whitelisted ips in `oci_autonomous_database`
811

examples/compute/extended_metadata/extended_metadata.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,12 @@ resource "oci_core_instance" "test_instance" {
9191
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
9292
compartment_id = "${var.compartment_ocid}"
9393
display_name = "TestInstance"
94-
hostname_label = "testinstance"
9594
shape = "VM.Standard2.1"
96-
subnet_id = "${oci_core_subnet.test_subnet.id}"
95+
96+
create_vnic_details {
97+
subnet_id = "${oci_core_subnet.test_subnet.id}"
98+
hostname_label = "testinstance"
99+
}
97100

98101
source_details {
99102
source_type = "image"

examples/compute/vnic/vnic.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ resource "oci_core_instance" "test_instance" {
7272
compartment_id = "${var.compartment_ocid}"
7373
display_name = "TestInstance"
7474
shape = "VM.Standard2.1"
75-
subnet_id = "${oci_core_subnet.test_subnet.id}"
7675

7776
source_details {
7877
source_type = "image"

examples/compute/windows/windows.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,18 @@ resource "oci_core_instance" "test_instance" {
183183
compartment_id = "${var.compartment_ocid}"
184184
display_name = "${var.instance_name}"
185185
shape = "VM.Standard2.1"
186-
subnet_id = "${oci_core_subnet.test_subnet.id}"
187-
hostname_label = "winmachine"
188186

189187
# Refer cloud-init in https://docs.cloud.oracle.com/iaas/api/#/en/iaas/20160918/datatypes/LaunchInstanceDetails
190188
metadata = {
191189
# Base64 encoded YAML based user_data to be passed to cloud-init
192190
user_data = "${data.template_cloudinit_config.cloudinit_config.rendered}"
193191
}
194192

193+
create_vnic_details {
194+
subnet_id = "${oci_core_subnet.test_subnet.id}"
195+
hostname_label = "winmachine"
196+
}
197+
195198
source_details {
196199
boot_volume_size_in_gbs = "${var.size_in_gbs}"
197200
source_id = "${var.instance_image_ocid[var.region]}"

examples/kms/instance.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ resource "oci_core_instance" "my_instance" {
44
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
55
compartment_id = "${var.compartment_id}"
66
display_name = "my instance with FSS access"
7-
hostname_label = "myinstance"
87
shape = "${var.instance_shape}"
9-
subnet_id = "${oci_core_subnet.my_subnet.id}"
108

119
metadata = {
1210
ssh_authorized_keys = "${var.ssh_public_key}"
1311
}
1412

13+
create_vnic_details {
14+
subnet_id = "${oci_core_subnet.my_subnet.id}"
15+
hostname_label = "myinstance"
16+
}
17+
1518
source_details {
1619
source_type = "image"
1720
source_id = "${var.instance_image_ocid[var.region]}"

examples/load_balancer/lb_full/lb_full.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,16 @@ resource "oci_core_instance" "instance1" {
153153
compartment_id = "${var.compartment_ocid}"
154154
display_name = "be-instance1"
155155
shape = "${var.instance_shape}"
156-
subnet_id = "${oci_core_subnet.subnet1.id}"
157-
hostname_label = "be-instance1"
158156

159157
metadata = {
160158
user_data = "${base64encode(var.user-data)}"
161159
}
162160

161+
create_vnic_details {
162+
subnet_id = "${oci_core_subnet.subnet1.id}"
163+
hostname_label = "be-instance1"
164+
}
165+
163166
source_details {
164167
source_type = "image"
165168
source_id = "${var.instance_image_ocid[var.region]}"
@@ -171,13 +174,16 @@ resource "oci_core_instance" "instance2" {
171174
compartment_id = "${var.compartment_ocid}"
172175
display_name = "be-instance2"
173176
shape = "${var.instance_shape}"
174-
subnet_id = "${oci_core_subnet.subnet2.id}"
175-
hostname_label = "be-instance2"
176177

177178
metadata = {
178179
user_data = "${base64encode(var.user-data)}"
179180
}
180181

182+
create_vnic_details {
183+
subnet_id = "${oci_core_subnet.subnet2.id}"
184+
hostname_label = "be-instance2"
185+
}
186+
181187
source_details {
182188
source_type = "image"
183189
source_id = "${var.instance_image_ocid[var.region]}"

examples/networking/private_ip/private_ip.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ resource "oci_core_instance" "test_instance1" {
6565
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
6666
compartment_id = "${var.compartment_ocid}"
6767
display_name = "testInstance"
68-
hostname_label = "instance"
6968
shape = "${var.instance_shape}"
7069

7170
create_vnic_details {
72-
subnet_id = "${oci_core_subnet.example_subnet.id}"
71+
subnet_id = "${oci_core_subnet.example_subnet.id}"
72+
hostname_label = "instance"
7373
}
7474

7575
source_details {

examples/networking/public_ip/public_ip.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ resource "oci_core_instance" "test_instance" {
6666
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
6767
compartment_id = "${var.compartment_ocid}"
6868
display_name = "testInstance"
69-
hostname_label = "instance"
7069
shape = "${var.instance_shape}"
7170

7271
source_details {
@@ -78,6 +77,7 @@ resource "oci_core_instance" "test_instance" {
7877
assign_public_ip = false
7978
display_name = "primaryVnic"
8079
subnet_id = "${oci_core_subnet.test_subnet.id}"
80+
hostname_label = "instance"
8181
}
8282
}
8383

examples/storage/fss/instance.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ resource "oci_core_instance" "my_instance" {
44
availability_domain = "${data.oci_identity_availability_domain.ad.name}"
55
compartment_id = "${var.compartment_ocid}"
66
display_name = "my instance with FSS access"
7-
hostname_label = "myinstance"
87
shape = "${var.instance_shape}"
9-
subnet_id = "${oci_core_subnet.my_subnet.id}"
108

119
metadata = {
1210
ssh_authorized_keys = "${var.ssh_public_key}"
1311
}
1412

13+
create_vnic_details {
14+
subnet_id = "${oci_core_subnet.my_subnet.id}"
15+
hostname_label = "myinstance"
16+
}
17+
1518
source_details {
1619
source_type = "image"
1720
source_id = "${var.instance_image_ocid[var.region]}"

oci/core_instance_resource.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ func CoreInstanceResource() *schema.Resource {
201201
Computed: true,
202202
ForceNew: true,
203203
DiffSuppressFunc: EqualIgnoreCaseSuppressDiff,
204+
Deprecated: FieldDeprecatedForAnother("hostname_label", "hostname_label under create_vnic_details"),
204205
},
205206
"image": {
206207
Type: schema.TypeString,
@@ -330,10 +331,11 @@ func CoreInstanceResource() *schema.Resource {
330331
},
331332
},
332333
"subnet_id": {
333-
Type: schema.TypeString,
334-
Optional: true,
335-
Computed: true,
336-
ForceNew: true,
334+
Type: schema.TypeString,
335+
Optional: true,
336+
Computed: true,
337+
ForceNew: true,
338+
Deprecated: FieldDeprecatedForAnother("subnet_id", "subnet_id under create_vnic_details"),
337339
},
338340

339341
// Computed

0 commit comments

Comments
 (0)