Skip to content

Commit d55a936

Browse files
authored
fix: Compartment AD listing, ignore lifecycle changes, resolve deprecation warning (#68)
* Use compartment_id for availability_domain data source Signed-off-by: Devon Crouse <[email protected]> * Fix deprecation warning for operator_subnet_id, ignore lifecycle changes Signed-off-by: Devon Crouse <[email protected]> Signed-off-by: Devon Crouse <[email protected]>
1 parent 02b86ef commit d55a936

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

compute.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ resource "oci_core_instance" "operator" {
3939
}
4040

4141
is_pv_encryption_in_transit_enabled = var.enable_pv_encryption_in_transit
42-
# prevent the operator from destroying and recreating itself if the image ocid changes
43-
lifecycle {
44-
ignore_changes = [source_details[0].source_id]
45-
}
4642

4743
metadata = {
4844
ssh_authorized_keys = (var.ssh_public_key != "") ? var.ssh_public_key : (var.ssh_public_key_path != "none") ? file(var.ssh_public_key_path) : ""
@@ -67,6 +63,11 @@ resource "oci_core_instance" "operator" {
6763

6864
state = var.operator_state
6965

66+
# prevent the operator from destroying and recreating itself if the image ocid/tagging/user data changes
67+
lifecycle {
68+
ignore_changes = [freeform_tags, metadata["user_data"], source_details[0].source_id]
69+
}
70+
7071
timeouts {
7172
create = "60m"
7273
}

datasources.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ data "oci_core_services" "all_oci_services" {
1010
}
1111

1212
data "oci_identity_availability_domain" "ad" {
13-
compartment_id = var.tenancy_id
14-
15-
ad_number = var.availability_domain
13+
compartment_id = var.compartment_id
14+
ad_number = var.availability_domain
1615
}
1716

1817
data "oci_identity_tenancy" "tenancy" {

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ output "operator_instance_principal_group_name" {
1010
}
1111

1212
output "operator_subnet_id" {
13-
value = data.oci_core_instance.operator.subnet_id
13+
value = oci_core_subnet.operator.id
1414
}
1515

1616
output "operator_nsg_id" {

security.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ resource "oci_core_security_list" "operator" {
6161
compartment_id = var.compartment_id
6262
display_name = var.label_prefix == "none" ? "operator" : "${var.label_prefix}-operator"
6363
freeform_tags = var.freeform_tags
64+
vcn_id = var.vcn_id
6465

6566
# egress rule to the same subnet to allow users to use OCI Bastion service to connect to the operator
6667
egress_security_rules {
@@ -73,5 +74,7 @@ resource "oci_core_security_list" "operator" {
7374
}
7475
}
7576

76-
vcn_id = var.vcn_id
77+
lifecycle {
78+
ignore_changes = [freeform_tags]
79+
}
7780
}

subnets.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ resource "oci_core_subnet" "operator" {
1111
route_table_id = var.nat_route_id
1212
security_list_ids = [oci_core_security_list.operator.id]
1313
vcn_id = var.vcn_id
14+
15+
lifecycle {
16+
ignore_changes = [freeform_tags]
17+
}
1418
}

0 commit comments

Comments
 (0)