From 04372a231f125569bf58d1f0aeb143164403bba7 Mon Sep 17 00:00:00 2001 From: Dimitris Moraitidis Date: Thu, 18 Apr 2024 11:15:55 +0200 Subject: [PATCH] add machine_type example add cos_image_name to container module, by only using the last element of the string tf fmt tf fmt fix ran terraform-docs --- README.md | 2 +- main.tf | 2 ++ variables.tf | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f4cbea..f784828 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,7 @@ You can check the status of the certificate in the Google Cloud Console. | [iap\_backend\_security\_policy](#input\_iap\_backend\_security\_policy) | Name of the security policy to apply to the IAP backend service | `string` | `null` | no | | [image](#input\_image) | Docker image. This is most often a reference to a container located in a container registry | `string` | `"ghcr.io/runatlantis/atlantis:latest"` | no | | [labels](#input\_labels) | Key-value pairs representing labels attaching to instance & instance template | `map(any)` | `{}` | no | -| [machine\_image](#input\_machine\_image) | The machine image to create VMs with, if not specified, latest cos\_cloud/cos\_stable is used | `string` | `null` | no | +| [machine\_image](#input\_machine\_image) | The machine image to create VMs with, if not specified, latest cos\_cloud/cos\_stable is used. To pin to one, use the following format: projects/cos-cloud/global/images/cos-stable-109-17800-147-54 | `string` | `null` | no | | [machine\_type](#input\_machine\_type) | The machine type to run Atlantis on | `string` | `"n2-standard-2"` | no | | [name](#input\_name) | Custom name that's used during resource creation | `string` | n/a | yes | | [network](#input\_network) | Name of the network | `string` | n/a | yes | diff --git a/main.tf b/main.tf index ea25b07..1a64a74 100644 --- a/main.tf +++ b/main.tf @@ -81,6 +81,8 @@ module "container" { source = "terraform-google-modules/container-vm/google" version = "3.1.1" + cos_image_name = element(split("/", var.machine_image), length(split("/", var.machine_image)) - 1) + container = { image = var.image securityContext = { diff --git a/variables.tf b/variables.tf index 1ec7677..00ae469 100644 --- a/variables.tf +++ b/variables.tf @@ -25,7 +25,7 @@ variable "zone" { variable "machine_image" { type = string - description = "The machine image to create VMs with, if not specified, latest cos_cloud/cos_stable is used" + description = "The machine image to create VMs with, if not specified, latest cos_cloud/cos_stable is used. To pin to one, use the following format: projects/cos-cloud/global/images/cos-stable-109-17800-147-54" default = null }