Skip to content

Commit

Permalink
chore!: change default distro image from CentOS 7 to Rocky Linux 9
Browse files Browse the repository at this point in the history
Main motivation behind this is that CentOS 7 is reaching its end of life
on June 30, 2024 and Rocky Linux is strongly supported by Google Cloud Platform.

BREAKING CHANGE: replaces existing default value for instance_template module
  • Loading branch information
dsalbert committed Jan 19, 2024
1 parent 4ef8541 commit a0a9feb
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 35 deletions.
7 changes: 3 additions & 4 deletions examples/mig/full/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ variable "labels" {

/* disk */
variable "source_image" {
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
default = ""
}

variable "source_image_family" {
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
default = ""
}

variable "source_image_project" {
description = "Project where the source image comes from"
description = "Project where the source image comes from. The default project contains Rocky Linux images."
default = ""
}

Expand Down Expand Up @@ -123,7 +123,6 @@ variable "additional_disks" {
default = []
}


/* metadata */
variable "startup_script" {
description = "User startup script to run when instances spin up"
Expand Down
1 change: 0 additions & 1 deletion examples/umig/full/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

provider "google" {

project = var.project_id
region = var.region
}
Expand Down
8 changes: 3 additions & 5 deletions examples/umig/full/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ variable "project_id" {
type = string
}



variable "hostname" {
description = "Hostname prefix for instances."
default = "default"
Expand Down Expand Up @@ -77,17 +75,17 @@ variable "labels" {

/* disk */
variable "source_image" {
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
default = ""
}

variable "source_image_family" {
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
default = ""
}

variable "source_image_project" {
description = "Project where the source image comes from"
description = "Project where the source image comes from. The default project contains Rocky Linux images."
default = ""
}

Expand Down
6 changes: 3 additions & 3 deletions modules/instance_template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ See the [simple](../../examples/instance_template/simple) for a usage example.
| resource\_policies | A list of self\_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. | `list(string)` | `[]` | no |
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account. | <pre>object({<br> email = string<br> scopes = set(string)<br> })</pre> | n/a | yes |
| shielded\_instance\_config | Not used unless enable\_shielded\_vm is true. Shielded VM configuration for the instance. | <pre>object({<br> enable_secure_boot = bool<br> enable_vtpm = bool<br> enable_integrity_monitoring = bool<br> })</pre> | <pre>{<br> "enable_integrity_monitoring": true,<br> "enable_secure_boot": true,<br> "enable_vtpm": true<br>}</pre> | no |
| source\_image | Source disk image. If neither source\_image nor source\_image\_family is specified, defaults to the latest public CentOS image. | `string` | `""` | no |
| source\_image\_family | Source image family. If neither source\_image nor source\_image\_family is specified, defaults to the latest public CentOS image. | `string` | `"centos-7"` | no |
| source\_image\_project | Project where the source image comes from. The default project contains CentOS images. | `string` | `"centos-cloud"` | no |
| source\_image | Source disk image. If neither source\_image nor source\_image\_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. | `string` | `""` | no |
| source\_image\_family | Source image family. If neither source\_image nor source\_image\_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. | `string` | `"rocky-linux-9-optimized-gcp"` | no |
| source\_image\_project | Project where the source image comes from. The default project contains Rocky Linux images. | `string` | `"rocky-linux-cloud"` | no |
| spot | Provision a SPOT instance | `bool` | `false` | no |
| spot\_instance\_termination\_action | Action to take when Compute Engine preempts a Spot VM. | `string` | `"STOP"` | no |
| stack\_type | The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are `IPV4_IPV6` or `IPV4_ONLY`. Default behavior is equivalent to IPV4\_ONLY. | `string` | `null` | no |
Expand Down
6 changes: 3 additions & 3 deletions modules/instance_template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#########

locals {
source_image = var.source_image != "" ? var.source_image : "centos-7-v20201112"
source_image_family = var.source_image_family != "" ? var.source_image_family : "centos-7"
source_image_project = var.source_image_project != "" ? var.source_image_project : "centos-cloud"
source_image = var.source_image != "" ? var.source_image : "rocky-linux-9-optimized-gcp-v20240111"
source_image_family = var.source_image_family != "" ? var.source_image_family : "rocky-linux-9-optimized-gcp"
source_image_project = var.source_image_project != "" ? var.source_image_project : "rocky-linux-cloud"

boot_disk = [
{
Expand Down
10 changes: 5 additions & 5 deletions modules/instance_template/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,17 @@ spec:
enable_secure_boot: true
enable_vtpm: true
- name: source_image
description: Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image.
description: Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image.
varType: string
defaultValue: ""
- name: source_image_family
description: Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image.
description: Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image.
varType: string
defaultValue: centos-7
defaultValue: rocky-linux-9-optimized-gcp
- name: source_image_project
description: Project where the source image comes from. The default project contains CentOS images.
description: Project where the source image comes from. The default project contains Rocky Linux images.
varType: string
defaultValue: centos-cloud
defaultValue: rocky-linux-cloud
- name: spot
description: Provision a SPOT instance
varType: bool
Expand Down
10 changes: 5 additions & 5 deletions modules/instance_template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,21 @@ variable "resource_policies" {
# disk
#######
variable "source_image" {
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
type = string
default = ""
}

variable "source_image_family" {
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
type = string
default = "centos-7"
default = "rocky-linux-9-optimized-gcp"
}

variable "source_image_project" {
description = "Project where the source image comes from. The default project contains CentOS images."
description = "Project where the source image comes from. The default project contains Rocky Linux images."
type = string
default = "centos-cloud"
default = "rocky-linux-cloud"
}

variable "disk_size_gb" {
Expand Down
6 changes: 3 additions & 3 deletions modules/preemptible_and_regular_instance_templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ See the [simple](../../examples/preemptible_and_regular_instance_templates/simpl
| network | The name or self\_link of the network to attach this interface to. Use network attribute for Legacy or Auto subnetted networks and subnetwork for custom subnetted networks. | `string` | `""` | no |
| project\_id | The GCP project ID | `string` | `null` | no |
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account. | <pre>object({<br> email = string<br> scopes = set(string)<br> })</pre> | n/a | yes |
| source\_image | Source disk image. If neither source\_image nor source\_image\_family is specified, defaults to the latest public CentOS image. | `string` | `""` | no |
| source\_image\_family | Source image family. If neither source\_image nor source\_image\_family is specified, defaults to the latest public CentOS image. | `string` | `""` | no |
| source\_image\_project | Project where the source image comes from | `string` | `""` | no |
| source\_image | Source disk image. If neither source\_image nor source\_image\_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. | `string` | `""` | no |
| source\_image\_family | Source image family. If neither source\_image nor source\_image\_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. | `string` | `""` | no |
| source\_image\_project | Project where the source image comes from. The default project contains Rocky Linux images. | `string` | `""` | no |
| startup\_script | User startup script to run when instances spin up | `string` | `""` | no |
| subnetwork | The name of the subnetwork to attach this interface to. The subnetwork must exist in the same region this instance will be created in. Either network or subnetwork must be provided. | `string` | `""` | no |
| subnetwork\_project | The ID of the project in which the subnetwork belongs. If it is not provided, the provider project is used. | `string` | `""` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ spec:
defaultValue: null
required: true
- name: source_image
description: Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image.
description: Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image.
varType: string
defaultValue: ""
- name: source_image_family
description: Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image.
description: Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image.
varType: string
defaultValue: ""
- name: source_image_project
description: Project where the source image comes from
description: Project where the source image comes from. The default project contains Rocky Linux images.
varType: string
defaultValue: ""
- name: startup_script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ variable "labels" {
# disk
#######
variable "source_image" {
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
type = string
default = ""
}

variable "source_image_family" {
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image."
description = "Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image."
type = string
default = ""
}

variable "source_image_project" {
description = "Project where the source image comes from"
description = "Project where the source image comes from. The default project contains Rocky Linux images."
type = string
default = ""
}
Expand Down

0 comments on commit a0a9feb

Please sign in to comment.