Skip to content

Commit

Permalink
chore: use google_compute_image data to identify image
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed May 29, 2024
1 parent 47a7827 commit 3a5d3a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion modules/inception/gcp/bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ locals {
bos_version = "18.2.0"
kratos_version = "0.11.1"
}
data "google_compute_image" "bastion" {
family = local.bastion_image_family
project = local.bastion_image_project
most_recent = true
}

resource "google_compute_instance" "bastion" {
project = local.project
Expand All @@ -26,7 +31,7 @@ resource "google_compute_instance" "bastion" {

boot_disk {
initialize_params {
image = local.bastion_image
image = data.google_compute_image.bastion.self_link
}
}

Expand Down
10 changes: 7 additions & 3 deletions modules/inception/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ variable "cluster_zone" {
variable "bastion_machine_type" {
default = "e2-micro"
}
variable "bastion_image" {
default = "ubuntu-os-cloud/ubuntu-2404-lts-amd64"
variable "bastion_image_project" {
default = "ubuntu-os-cloud"
}
variable "bastion_image_family" {
default = "ubuntu-2404-lts-amd64"
}
variable "bastion_revoke_on_exit" {
default = true
Expand Down Expand Up @@ -61,7 +64,8 @@ locals {
cluster_location = var.cluster_zone == "" ? local.region : "${local.region}-${var.cluster_zone}"
bastion_zone = "${local.region}-${var.primary_zone}"
bastion_machine_type = var.bastion_machine_type
bastion_image = var.bastion_image
bastion_image_project = var.bastion_image_project
bastion_image_family = var.bastion_image_family
bastion_revoke_on_exit = var.bastion_revoke_on_exit
tf_state_bucket_policy = var.tf_state_bucket_policy
}

0 comments on commit 3a5d3a3

Please sign in to comment.