Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add labels to resources/modules where missing #83

Merged
merged 2 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions resources/compute/simple-instance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ No modules.

| Name | Type |
|------|------|
| [google_compute_disk.boot_disk](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_disk) | resource |
| [google_compute_instance.compute_vm](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance) | resource |
| [google_compute_image.compute_image](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_image) | data source |

Expand Down
20 changes: 15 additions & 5 deletions resources/compute/simple-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ data "google_compute_image" "compute_image" {
project = var.instance_image.project
}

resource "google_compute_disk" "boot_disk" {
cboneti marked this conversation as resolved.
Show resolved Hide resolved
count = var.instance_count

name = var.name_prefix != null ? (
"${var.name_prefix}-boot-disk-${count.index}") : (
"${var.deployment_name}-boot-disk-${count.index}")
image = data.google_compute_image.compute_image.self_link
type = var.disk_type
size = var.disk_size_gb
labels = var.labels
}

resource "google_compute_instance" "compute_vm" {
count = var.instance_count

Expand All @@ -31,11 +43,9 @@ resource "google_compute_instance" "compute_vm" {
labels = var.labels

boot_disk {
initialize_params {
image = data.google_compute_image.compute_image.self_link
type = var.disk_type
size = var.disk_size_gb
}
source = google_compute_disk.boot_disk[count.index].self_link
device_name = google_compute_disk.boot_disk[count.index].name
auto_delete = true
}

network_interface {
Expand Down
9 changes: 9 additions & 0 deletions resources/compute/simple-instance/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
}
],
"resources": [
{
"type": "compute_disk",
"name": "boot_disk",
"provider": "google",
"source": "hashicorp/google",
"mode": "managed",
"version": "latest",
"description": null
},
{
"type": "compute_instance",
"name": "compute_vm",
Expand Down
1 change: 1 addition & 0 deletions resources/project/new-project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ No resources.
| <a name="input_billing_account"></a> [billing\_account](#input\_billing\_account) | The ID of the billing account to associate projects with. | `string` | n/a | yes |
| <a name="input_default_service_account"></a> [default\_service\_account](#input\_default\_service\_account) | Project default service account setting: can be one of `delete`, `deprivilege`, `disable`, or `keep`. | `string` | `"keep"` | no |
| <a name="input_folder_id"></a> [folder\_id](#input\_folder\_id) | ID of the Folder | `string` | n/a | yes |
| <a name="input_labels"></a> [labels](#input\_labels) | Labels for the project. List key, value pairs. | `any` | n/a | yes |
| <a name="input_org_id"></a> [org\_id](#input\_org\_id) | ID of the organization | `string` | n/a | yes |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | ID of the Project | `string` | n/a | yes |

Expand Down
1 change: 1 addition & 0 deletions resources/project/new-project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ module "project_factory" {
org_id = var.org_id
billing_account = var.billing_account
default_service_account = var.default_service_account
labels = var.labels
}
7 changes: 7 additions & 0 deletions resources/project/new-project/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
"default": null,
"required": true
},
{
"name": "labels",
"type": "any",
"description": "Labels for the project. List key, value pairs.",
"default": null,
"required": true
},
{
"name": "org_id",
"type": "string",
Expand Down
5 changes: 5 additions & 0 deletions resources/project/new-project/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ variable "org_id" {
description = "ID of the organization"
type = string
}

variable "labels" {
description = "Labels for the project. List key, value pairs."
type = any
}
1 change: 1 addition & 0 deletions resources/scripts/startup-script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ No modules.
|------|-------------|------|---------|:--------:|
| <a name="input_debug_file"></a> [debug\_file](#input\_debug\_file) | Path to an optional local to be written with 'startup\_script\_content'. | `string` | `null` | no |
| <a name="input_deployment_name"></a> [deployment\_name](#input\_deployment\_name) | Name of the HPC deployment, used to name GCS bucket for startup scripts. | `string` | n/a | yes |
| <a name="input_labels"></a> [labels](#input\_labels) | Labels for the created GCS bucket. List key, value pairs. | `any` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | The region to deploy to | `string` | n/a | yes |
| <a name="input_runners"></a> [runners](#input\_runners) | List of runners to run on remote VM.<br> Runners can be of type ansible-local, shell or data.<br> A runner must specify one of 'source' or 'content'.<br> All runners must specify 'destination'. If 'destination' does not include a<br> path, it will be copied in a temporary folder and deleted after running.<br> Runners may also pass 'args', which will be passed as argument to shell runners only. | `list(map(string))` | `[]` | no |

Expand Down
1 change: 1 addition & 0 deletions resources/scripts/startup-script/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ resource "google_storage_bucket" "configs_bucket" {
uniform_bucket_level_access = true
location = var.region
storage_class = "REGIONAL"
labels = var.labels
}

resource "google_storage_bucket_object" "scripts" {
Expand Down
7 changes: 7 additions & 0 deletions resources/scripts/startup-script/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
"default": null,
"required": true
},
{
"name": "labels",
"type": "any",
"description": "Labels for the created GCS bucket. List key, value pairs.",
"default": null,
"required": true
},
{
"name": "region",
"type": "string",
Expand Down
5 changes: 5 additions & 0 deletions resources/scripts/startup-script/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ variable "debug_file" {
default = null
}

variable "labels" {
description = "Labels for the created GCS bucket. List key, value pairs."
type = any
}

variable "runners" {
description = <<EOT
List of runners to run on remote VM.
Expand Down