Skip to content

Commit

Permalink
Ignore lifecycle changes for defined/freeform tags (#100)
Browse files Browse the repository at this point in the history
Signed-off-by: Devon Crouse <[email protected]>

Signed-off-by: Devon Crouse <[email protected]>
  • Loading branch information
devoncrouse authored Oct 8, 2022
1 parent 726fd2f commit 52158fb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Given a version number MAJOR.MINOR.PATCH:
- PATCH version when making backwards compatible bug fixes.
== 4.0.0 (not released)
* Ignored lifecycle changes for defined_tags, freeform_tags

== 3.5.1 (September 5, 2022))
* removed DRG submodule, now promoted to terraform-oci-drg module (feat: )
* updated examples to use GitHub repo as source ()

Expand Down
4 changes: 4 additions & 0 deletions modules/subnet/subnet.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ resource "oci_core_subnet" "vcn_subnet" {
prohibit_public_ip_on_vnic = lookup(each.value, "type", "public") == "public" ? false : true
route_table_id = lookup(each.value, "type", "public") == "public" ? var.ig_route_id : var.nat_route_id
security_list_ids = null

lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}
}

data "oci_core_dhcp_options" "dhcp_options" {
Expand Down
4 changes: 4 additions & 0 deletions vcn.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ resource "oci_core_vcn" "vcn" {
freeform_tags = var.freeform_tags
defined_tags = var.defined_tags
lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}
}
#Module for Subnet
Expand Down
24 changes: 24 additions & 0 deletions vcn_gateways.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ resource "oci_core_internet_gateway" "ig" {
vcn_id = oci_core_vcn.vcn.id
lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}
count = var.create_internet_gateway == true ? 1 : 0
}
Expand Down Expand Up @@ -76,6 +80,10 @@ resource "oci_core_route_table" "ig" {

vcn_id = oci_core_vcn.vcn.id

lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}

count = var.create_internet_gateway == true ? 1 : 0
}

Expand Down Expand Up @@ -103,6 +111,10 @@ resource "oci_core_service_gateway" "service_gateway" {
vcn_id = oci_core_vcn.vcn.id
lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}
count = var.create_service_gateway == true ? 1 : 0
}
Expand All @@ -120,6 +132,10 @@ resource "oci_core_nat_gateway" "nat_gateway" {
vcn_id = oci_core_vcn.vcn.id
lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}
count = var.create_nat_gateway == true ? 1 : 0
}
Expand Down Expand Up @@ -195,6 +211,10 @@ resource "oci_core_route_table" "nat" {

vcn_id = oci_core_vcn.vcn.id

lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}

count = var.create_nat_gateway == true ? 1 : 0
}

Expand All @@ -217,4 +237,8 @@ resource "oci_core_local_peering_gateway" "lpg" {
#Optional
peer_id = can(each.value.peer_id) == false ? null : each.value.peer_id
route_table_id = can(each.value.route_table_id) == false ? null : each.value.route_table_id
lifecycle {
ignore_changes = [defined_tags, freeform_tags]
}
}

0 comments on commit 52158fb

Please sign in to comment.