Skip to content

Commit 9bdd49b

Browse files
Kinder changes (#28)
* added new c3 vms to policies * added gp with local ssd to policies and variables * Update policies.md * changed machine type default in variables * fixed typo in policies and variables * created rhel example * added outputs and standardized files * fixed provider details * fixed main.tf * terraform-docs: automated action --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 00827a1 commit 9bdd49b

File tree

9 files changed

+153
-11
lines changed

9 files changed

+153
-11
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ Note that this example may create resources. Run `terraform destroy` when you do
181181

182182
| Name | Version |
183183
|------|---------|
184-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.5.0 |
185-
| <a name="requirement_google"></a> [google](#requirement\_google) | ~> 4.50 |
184+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.5.2 |
185+
| <a name="requirement_google"></a> [google](#requirement\_google) | ~> 4.79 |
186186

187187
## Providers
188188

189189
| Name | Version |
190190
|------|---------|
191-
| <a name="provider_google"></a> [google](#provider\_google) | ~> 4.50 |
191+
| <a name="provider_google"></a> [google](#provider\_google) | ~> 4.79 |
192192

193193
## Modules
194194

@@ -214,7 +214,7 @@ No modules.
214214
| <a name="input_boot_disk_mode"></a> [boot\_disk\_mode](#input\_boot\_disk\_mode) | The mode in which to attach this disk, either READ\_WRITE or READ\_ONLY. | `string` | `"READ_WRITE"` | no |
215215
| <a name="input_boot_disk_size"></a> [boot\_disk\_size](#input\_boot\_disk\_size) | Size of the OS disk | `number` | `100` | no |
216216
| <a name="input_boot_disk_source"></a> [boot\_disk\_source](#input\_boot\_disk\_source) | The name or self\_link of the existing disk (such as those managed by google\_compute\_disk) or disk image. | `string` | `null` | no |
217-
| <a name="input_boot_disk_type"></a> [boot\_disk\_type](#input\_boot\_disk\_type) | Disk type associated with the OS disk | `string` | `"pd-ssd"` | no |
217+
| <a name="input_boot_disk_type"></a> [boot\_disk\_type](#input\_boot\_disk\_type) | Disk type associated with the OS disk. Values can be either pd-ssd, local-ssd, or pd-standard | `string` | `"pd-ssd"` | no |
218218
| <a name="input_boot_image_family"></a> [boot\_image\_family](#input\_boot\_image\_family) | The image from which to initialize this disk | `string` | `"ubuntu-2204-lts"` | no |
219219
| <a name="input_boot_image_project"></a> [boot\_image\_project](#input\_boot\_image\_project) | The ID of the project in which the source image resides. | `string` | `"ubuntu-os-cloud"` | no |
220220
| <a name="input_can_ip_forward"></a> [can\_ip\_forward](#input\_can\_ip\_forward) | Conditional that allows sending and receiving of packets with non-matching source or destination IPs. | `bool` | `false` | no |

examples/gcp-rhel-vm/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<p align="center">
2+
<img src="https://github.com/intel/terraform-intel-gcp-vm/blob/main/images/logo-classicblue-800px.png?raw=true" alt="Intel Logo" width="250"/>
3+
</p>
4+
5+
# Intel Cloud Optimization Modules for Terraform
6+
7+
© Copyright 2022, Intel Corporation
8+
9+
## Intel Red Hat Enterprise Linux GCP VM Example
10+
11+
This module creates a Red Hat Enterprise Linux (RHEL) VM on the Intel Sapphire Rapids CPU. The virtual machine is created on an Intel Sapphire Rapids c3-standard-4 by default.
12+
13+
Update the project with a your project id in GCP. It is located on the variables.tf file under this example folder for "GCP-Linux-VM".
14+
15+
For the list of publicly available images for compute engines see https://cloud.google.com/compute/docs/images OR run gcloud compute images list --project gce-uefi-images to see the name, project, family and status easily in the CLI
16+
17+
## Usage
18+
19+
**See examples folder for complete examples.**
20+
21+
variables.tf
22+
23+
```hcl
24+
variable "project" {
25+
type = string
26+
description = "The ID of the project in which the resource resides."
27+
}
28+
```
29+
30+
main.tf
31+
```hcl
32+
# You will need to provide value of the variable project, which is your GCP project id when you do terraform apply
33+
34+
module "rhel_vm" {
35+
source = "intel/gcp-vm/intel"
36+
project = var.project
37+
boot_image_family = "rhel-8"
38+
boot_image_project = "rhel-cloud"
39+
name = "vm1"
40+
access_config = [{
41+
nat_ip = null
42+
public_ptr_domain_name = null
43+
network_tier = "PREMIUM"
44+
}, ]
45+
}
46+
```
47+
48+
49+
50+
Run Terraform
51+
52+
```hcl
53+
terraform init
54+
terraform plan
55+
terraform apply -var="project=<your_your_gcp_project_id>"
56+
```
57+
58+
## Considerations
59+
Add additional considerations here:
60+
- The GCP zone can be updated in the providers.tf file under this example folder for "GCP-Linux-VM"
61+
- Update the project with a your project id in GCP. It is located on the variables.tf file under this example folder for "GCP-Linux-VM"
62+
- The VM is created using the default network in the GCP zone configured in the providers.tf file. Please make sure you have a default network in the GCP zone
63+
of your choice

examples/gcp-rhel-vm/main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# --------------------------------------------------------
2+
# _ _ _
3+
# (_) | | | |
4+
# _ _ __ | |_ ___| |
5+
# | | '_ \| __/ _ \ |
6+
# | | | | | || __/ |
7+
# |_|_| |_|\__\___|_|
8+
# --------------------------------------------------------
9+
# Provision GCP Xeon 4th Generation Scalable processors (code-named Sapphire Rapids) VM
10+
# You will need to provide value of the variable project, which is your GCP project id when you do terraform apply
11+
module "rhel_vm" {
12+
source = "intel/gcp-vm/intel"
13+
project = var.project
14+
boot_image_family = "rhel-8"
15+
boot_image_project = "rhel-cloud"
16+
name = "vm1"
17+
access_config = [{
18+
nat_ip = null
19+
public_ptr_domain_name = null
20+
network_tier = "PREMIUM"
21+
}, ]
22+
}

examples/gcp-rhel-vm/outputs.tf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
output "name" {
2+
value = module.rhel_vm.cpu_platform
3+
description = "A unique name for the resource, required by GCE. Changing this forces a new resource to be created."
4+
}
5+
6+
output "instance_id" {
7+
value = module.rhel_vm.instance_id
8+
description = "The server-assigned unique identifier of this instance"
9+
}
10+
11+
output "boot_disk_family" {
12+
value = module.rhel_vm.boot_disk_size
13+
description = "The image from which to initialize this disk"
14+
}
15+
16+
output "boot_disk_project" {
17+
value = module.rhel_vm.boot_disk_size
18+
description = "The ID of the project in which the source image resides."
19+
}
20+
21+
output "tags" {
22+
value = module.rhel_vm.machine_type
23+
description = "A list of network tags to attach to the instance"
24+
}
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+

examples/gcp-rhel-vm/providers.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
provider "google" {
2+
zone = "us-central1-a"
3+
}

examples/gcp-rhel-vm/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
variable "project" {
2+
type = string
3+
description = "The ID of the project in which the resource resides."
4+
}
5+

examples/gcp-rhel-vm/versions.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = "~> 1.5.2" # see https://releases.hashicorp.com/terraform/
3+
4+
required_providers {
5+
google = {
6+
source = "hashicorp/google"
7+
version = "~> 4.50"
8+
}
9+
}
10+
}

variables.tf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ variable "project" {
8181
description = "The ID of the project in which the resource resides."
8282
default = ""
8383
}
84-
8584
variable "service_account" {
8685
type = object({
8786
service_email = optional(string, null)
@@ -109,7 +108,7 @@ variable "boot_disk_size" {
109108

110109
variable "boot_disk_type" {
111110
type = string
112-
description = "Disk type associated with the OS disk"
111+
description = "Disk type associated with the OS disk. Values can be either pd-ssd, local-ssd, or pd-standard"
113112
default = "pd-ssd"
114113
}
115114

@@ -118,7 +117,6 @@ variable "boot_image_project" {
118117
description = "The ID of the project in which the source image resides."
119118
default = "ubuntu-os-cloud"
120119
}
121-
122120
variable "zone" {
123121
type = string
124122
description = "The zone that the machine should be created in. If it is not provided, the provider zone is used."
@@ -284,8 +282,8 @@ variable "visible_core_count" {
284282
default = null
285283
}
286284

287-
variable user_data {
285+
variable "user_data" {
288286
type = string
289287
description = "User data to be placed on the instance. Used to place cloud-init on VMs"
290288
default = null
291-
}
289+
}

versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = "~> 1.5.0" # see https://releases.hashicorp.com/terraform/
2+
required_version = "~> 1.5.2" # see https://releases.hashicorp.com/terraform/
33

44
required_providers {
55
google = {
66
source = "hashicorp/google"
7-
version = "~> 4.50"
7+
version = "~> 4.79"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)