Skip to content

Commit

Permalink
chore: Update variable's order in variables.tf and update display met…
Browse files Browse the repository at this point in the history
…adata
  • Loading branch information
q2w committed Nov 27, 2024
1 parent 780d187 commit ffcfb17
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 93 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ docker_generate_docs:
-e ENABLE_BPMETADATA \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs'
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs display'

# Generate files from autogen
.PHONY: docker_generate_modules
Expand Down
22 changes: 11 additions & 11 deletions autogen/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ variable "project_id" {
default = null
}

variable "hostname" {
description = "Hostname prefix for instances"
variable "region" {
description = "The Google Cloud region where the managed instance group resides."
type = string
default = "default"
}

variable "mig_name" {
Expand All @@ -34,9 +33,16 @@ variable "mig_name" {
default = ""
}

variable "region" {
description = "The Google Cloud region where the managed instance group resides."
variable "hostname" {
description = "Hostname prefix for instances"
type = string
default = "default"
}

variable "target_size" {
description = "The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set."
type = number
default = 1
}

{% if mig %}
Expand All @@ -62,12 +68,6 @@ variable "next_version_percent" {
}

{% endif %}
variable "target_size" {
description = "The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set."
type = number
default = 1
}

variable "target_pools" {
description = "The target load balancing pools to assign this group to."
type = list(string)
Expand Down
10 changes: 9 additions & 1 deletion modules/instance_template/metadata.display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
description:
name: description
title: Description
invisible: false
disk_encryption_key:
name: disk_encryption_key
title: Disk Encryption Key
Expand Down Expand Up @@ -90,6 +91,7 @@ spec:
instance_description:
name: instance_description
title: Instance Description
invisible: false
ipv6_access_config:
name: ipv6_access_config
title: Ipv6 Access Config
Expand All @@ -99,6 +101,7 @@ spec:
machine_type:
name: machine_type
title: Machine Type
invisible: false
maintenance_interval:
name: maintenance_interval
title: Maintenance Interval
Expand All @@ -111,6 +114,9 @@ spec:
name_prefix:
name: name_prefix
title: Name Prefix
invisible: false
regexValidation: ^[a-z][a-z0-9-]{0,51}[a-z0-9]$
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 53 characters or fewer.
network:
name: network
title: Network
Expand All @@ -129,9 +135,11 @@ spec:
project_id:
name: project_id
title: Project Id
invisible: false
region:
name: region
title: Region
invisible: false
resource_policies:
name: resource_policies
title: Resource Policies
Expand All @@ -153,6 +161,7 @@ spec:
spot:
name: spot
title: Spot
invisible: false
spot_instance_termination_action:
name: spot_instance_termination_action
title: Spot Instance Termination Action
Expand All @@ -177,4 +186,3 @@ spec:
total_egress_bandwidth_tier:
name: total_egress_bandwidth_tier
title: Total Egress Bandwidth Tier

40 changes: 20 additions & 20 deletions modules/instance_template/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,21 @@ spec:
- name: project_id
description: The GCP project ID
varType: string
- name: region
description: Region where the instance template should be created.
varType: string
- name: name_prefix
description: Name prefix for the instance template
varType: string
defaultValue: default-instance-template
- name: machine_type
description: Machine type to create, e.g. n1-standard-1
varType: string
defaultValue: n1-standard-1
- name: spot
description: Provision a SPOT instance
varType: bool
defaultValue: false
- name: description
description: The template's description
varType: string
Expand All @@ -95,10 +106,6 @@ spec:
description: Description of the generated instances
varType: string
defaultValue: ""
- name: machine_type
description: Machine type to create, e.g. n1-standard-1
varType: string
defaultValue: n1-standard-1
- name: min_cpu_platform
description: "Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list: https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform"
varType: string
Expand All @@ -118,10 +125,6 @@ spec:
description: Allow the instance to be preempted
varType: bool
defaultValue: false
- name: spot
description: Provision a SPOT instance
varType: bool
defaultValue: false
- name: automatic_restart
description: (Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user).
varType: bool
Expand All @@ -137,9 +140,6 @@ spec:
description: Action to take when Compute Engine preempts a Spot VM.
varType: string
defaultValue: STOP
- name: region
description: Region where the instance template should be created.
varType: string
- name: enable_nested_virtualization
description: Defines whether the instance should have nested virtualization enabled.
varType: bool
Expand Down Expand Up @@ -265,24 +265,24 @@ spec:
connections:
- source:
source: github.com/terraform-google-modules/terraform-google-memorystore
version: ~> 10.0
version: ">= 12.0"
spec:
outputExpr: env_vars
outputExpr: "{\"REDIS_HOST\": host, \"REDIS_PORT\": port}"
- source:
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/postgresql
version: ~> 21.0
version: ">= 23.0"
spec:
outputExpr: env_vars
outputExpr: "{\"CLOUD_SQL_DATABASE_HOST\" : instance_first_ip_address, \"CLOUD_SQL_DATABASE_CONNECTION_NAME\" : instance_connection_name, \"CLOUD_SQL_DATABASE_NAME\" : env_vars.CLOUD_SQL_DATABASE_NAME}"
- source:
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/mysql
version: ~> 22.0
version: ">= 23.0"
spec:
outputExpr: env_vars
outputExpr: "{\"CLOUD_SQL_DATABASE_HOST\" : instance_first_ip_address, \"CLOUD_SQL_DATABASE_CONNECTION_NAME\" : instance_connection_name, \"CLOUD_SQL_DATABASE_NAME\" : env_vars.CLOUD_SQL_DATABASE_NAME}"
- source:
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
version: ~> 4.3
version: ">= 4.4"
spec:
outputExpr: env_vars
outputExpr: "{\"SERVICE_ACCOUNT_EMAIL\" : email, \"SERVICE_ACCOUNT_IAM_EMAIL\" : iam_email}"
- name: service_account
description: Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account.
varType: |-
Expand All @@ -294,7 +294,7 @@ spec:
connections:
- source:
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
version: ~> 4.3
version: ">= 4.4"
spec:
outputExpr: email
inputPath: email
Expand Down
36 changes: 18 additions & 18 deletions modules/instance_template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,30 @@ variable "project_id" {
default = null
}

variable "region" {
type = string
description = "Region where the instance template should be created."
default = null
}

variable "name_prefix" {
description = "Name prefix for the instance template"
type = string
default = "default-instance-template"
}

variable "machine_type" {
description = "Machine type to create, e.g. n1-standard-1"
type = string
default = "n1-standard-1"
}

variable "spot" {
type = bool
description = "Provision a SPOT instance"
default = false
}

variable "description" {
description = "The template's description"
type = string
Expand All @@ -38,12 +56,6 @@ variable "instance_description" {
default = ""
}

variable "machine_type" {
description = "Machine type to create, e.g. n1-standard-1"
type = string
default = "n1-standard-1"
}

variable "min_cpu_platform" {
description = "Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list: https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform"
type = string
Expand Down Expand Up @@ -74,12 +86,6 @@ variable "preemptible" {
default = false
}

variable "spot" {
type = bool
description = "Provision a SPOT instance"
default = false
}

variable "automatic_restart" {
type = bool
description = "(Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user)."
Expand Down Expand Up @@ -113,12 +119,6 @@ variable "spot_instance_termination_action" {
}
}

variable "region" {
type = string
description = "Region where the instance template should be created."
default = null
}

variable "enable_nested_virtualization" {
type = bool
description = "Defines whether the instance should have nested virtualization enabled."
Expand Down
6 changes: 6 additions & 0 deletions modules/mig/metadata.display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ spec:
hostname:
name: hostname
title: Hostname
invisible: false
instance_template:
name: instance_template
title: Instance Template
Expand All @@ -79,6 +80,9 @@ spec:
mig_name:
name: mig_name
title: Mig Name
invisible: false
regexValidation: ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 63 characters or fewer.
mig_timeouts:
name: mig_timeouts
title: Mig Timeouts
Expand All @@ -91,6 +95,7 @@ spec:
project_id:
name: project_id
title: Project Id
invisible: false
region:
name: region
title: Region
Expand All @@ -109,6 +114,7 @@ spec:
target_size:
name: target_size
title: Target Size
invisible: false
update_policy:
name: update_policy
title: Update Policy
Expand Down
22 changes: 11 additions & 11 deletions modules/mig/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,32 @@ spec:
- name: project_id
description: The Google Cloud project ID
varType: string
- name: hostname
description: Hostname prefix for instances
- name: region
description: The Google Cloud region where the managed instance group resides.
varType: string
defaultValue: default
required: true
- name: mig_name
description: Managed instance group name. When variable is empty, name will be derived from var.hostname.
varType: string
defaultValue: ""
- name: region
description: The Google Cloud region where the managed instance group resides.
- name: hostname
description: Hostname prefix for instances
varType: string
required: true
defaultValue: default
- name: target_size
description: The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set.
varType: number
defaultValue: 1
- name: instance_template
description: Instance template self_link used to create compute instances
varType: string
required: true
connections:
- source:
source: github.com/terraform-google-modules/terraform-google-vm//modules/instance_template
version: ~> 12.0
version: ">= 12.0"
spec:
outputExpr: self_link
- name: target_size
description: The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set.
varType: number
defaultValue: 1
- name: target_pools
description: The target load balancing pools to assign this group to.
varType: list(string)
Expand Down
20 changes: 10 additions & 10 deletions modules/mig/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ variable "project_id" {
default = null
}

variable "hostname" {
description = "Hostname prefix for instances"
variable "region" {
description = "The Google Cloud region where the managed instance group resides."
type = string
default = "default"
}

variable "mig_name" {
Expand All @@ -34,14 +33,10 @@ variable "mig_name" {
default = ""
}

variable "region" {
description = "The Google Cloud region where the managed instance group resides."
type = string
}

variable "instance_template" {
description = "Instance template self_link used to create compute instances"
variable "hostname" {
description = "Hostname prefix for instances"
type = string
default = "default"
}

variable "target_size" {
Expand All @@ -50,6 +45,11 @@ variable "target_size" {
default = 1
}

variable "instance_template" {
description = "Instance template self_link used to create compute instances"
type = string
}

variable "target_pools" {
description = "The target load balancing pools to assign this group to."
type = list(string)
Expand Down
Loading

0 comments on commit ffcfb17

Please sign in to comment.