Skip to content

Commit 6317065

Browse files
authored
fix: Ignore lifecycle changes, and use consistent fallback shape (#51)
* Use up-to-date fallback shape consistently Signed-off-by: Devon Crouse <[email protected]> * Ignore lifecycle changes for availability_domain, defined_tags, metadata Signed-off-by: Devon Crouse <[email protected]> Signed-off-by: Devon Crouse <[email protected]>
1 parent 7aba082 commit 6317065

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

compute.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ resource "oci_core_instance" "bastion" {
3434

3535
# prevent the bastion from destroying and recreating itself if the image ocid changes
3636
lifecycle {
37-
ignore_changes = [freeform_tags, source_details[0].source_id]
37+
ignore_changes = [availability_domain, defined_tags, freeform_tags, metadata, source_details[0].source_id]
3838
}
3939

4040
metadata = {
4141
ssh_authorized_keys = (var.ssh_public_key != "") ? var.ssh_public_key : (var.ssh_public_key_path != "none") ? file(var.ssh_public_key_path) : ""
4242
user_data = var.bastion_image_id == "Autonomous" ? data.cloudinit_config.bastion.rendered : null
4343
}
4444

45-
shape = lookup(var.bastion_shape, "shape", "VM.Standard.E2.2")
45+
shape = local.shape
4646

4747
dynamic "shape_config" {
48-
for_each = length(regexall("Flex", lookup(var.bastion_shape, "shape", "VM.Standard.E3.Flex"))) > 0 ? [1] : []
48+
for_each = length(regexall("Flex", local.shape)) > 0 ? [1] : []
4949
content {
5050
ocpus = max(1, lookup(var.bastion_shape, "ocpus", 1))
5151
memory_in_gbs = (lookup(var.bastion_shape, "memory", 4) / lookup(var.bastion_shape, "ocpus", 1)) > 64 ? (lookup(var.bastion_shape, "ocpus", 1) * 4) : lookup(var.bastion_shape, "memory", 4)

locals.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ locals {
1313

1414
bastion_image_id = var.bastion_image_id == "Autonomous" ? data.oci_core_images.autonomous_images.images.0.id : var.bastion_image_id
1515

16+
default_shape = "VM.Standard.E4.Flex"
17+
shape = lookup(var.bastion_shape, "shape", local.default_shape)
18+
1619
notification_template = base64gzip(
1720
templatefile("${path.module}/scripts/notification.template.sh",
1821
{

0 commit comments

Comments
 (0)