Merge branch 'master' into feature/project-factory-default-folder-id
This commit is contained in:
commit
28dee84fc6
|
@ -64,3 +64,21 @@ In a future release, we could support:
|
||||||
- Google managed VPCs that are peered with PSA (such as Cloud SQL or Memorystore)
|
- Google managed VPCs that are peered with PSA (such as Cloud SQL or Memorystore)
|
||||||
|
|
||||||
If you are interested in this and/or would like to contribute, please contact legranda@google.com.
|
If you are interested in this and/or would like to contribute, please contact legranda@google.com.
|
||||||
|
<!-- BEGIN TFDOC -->
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
|
||||||
|
| name | description | type | required | default |
|
||||||
|
|---|---|:---:|:---:|:---:|
|
||||||
|
| [billing_account](variables.tf#L17) | The ID of the billing account to associate this project with | <code></code> | ✓ | |
|
||||||
|
| [monitored_projects_list](variables.tf#L36) | ID of the projects to be monitored (where limits and quotas data will be pulled) | <code>list(string)</code> | ✓ | |
|
||||||
|
| [organization_id](variables.tf#L47) | The organization id for the associated services | <code></code> | ✓ | |
|
||||||
|
| [prefix](variables.tf#L51) | Customer name to use as prefix for monitoring project | <code></code> | ✓ | |
|
||||||
|
| [cf_version](variables.tf#L21) | Cloud Function version 2nd Gen or 1st Gen. Possible options: 'V1' or 'V2'.Use CFv2 if your Cloud Function timeouts after 9 minutes. By default it is using CFv1. | <code></code> | | <code>V1</code> |
|
||||||
|
| [monitored_folders_list](variables.tf#L30) | ID of the projects to be monitored (where limits and quotas data will be pulled) | <code>list(string)</code> | | <code>[]</code> |
|
||||||
|
| [monitoring_project_id](variables.tf#L41) | Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string | <code></code> | | |
|
||||||
|
| [project_monitoring_services](variables.tf#L55) | Service APIs enabled in the monitoring project if it will be created. | <code></code> | | <code title="[ "artifactregistry.googleapis.com", "cloudasset.googleapis.com", "cloudbilling.googleapis.com", "cloudbuild.googleapis.com", "cloudresourcemanager.googleapis.com", "cloudscheduler.googleapis.com", "compute.googleapis.com", "cloudfunctions.googleapis.com", "iam.googleapis.com", "iamcredentials.googleapis.com", "logging.googleapis.com", "monitoring.googleapis.com", "run.googleapis.com", "serviceusage.googleapis.com" ]">[…]</code> |
|
||||||
|
| [region](variables.tf#L75) | Region used to deploy the cloud functions and scheduler | <code></code> | | <code>europe-west1</code> |
|
||||||
|
| [schedule_cron](variables.tf#L80) | Cron format schedule to run the Cloud Function. Default is every 10 minutes. | <code></code> | | <code>*/10 * * * *</code> |
|
||||||
|
|
||||||
|
<!-- END TFDOC -->
|
||||||
|
|
|
@ -14,27 +14,17 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
variable "organization_id" {
|
|
||||||
description = "The organization id for the associated services"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "billing_account" {
|
variable "billing_account" {
|
||||||
description = "The ID of the billing account to associate this project with"
|
description = "The ID of the billing account to associate this project with"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "monitoring_project_id" {
|
variable "cf_version" {
|
||||||
description = "Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string"
|
description = "Cloud Function version 2nd Gen or 1st Gen. Possible options: 'V1' or 'V2'.Use CFv2 if your Cloud Function timeouts after 9 minutes. By default it is using CFv1."
|
||||||
default = ""
|
default = "V1"
|
||||||
}
|
validation {
|
||||||
|
condition = var.cf_version == "V1" || var.cf_version == "V2"
|
||||||
variable "prefix" {
|
error_message = "The value of cf_version must be either V1 or V2."
|
||||||
description = "Customer name to use as prefix for monitoring project"
|
}
|
||||||
default = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "monitored_projects_list" {
|
|
||||||
type = list(string)
|
|
||||||
description = "ID of the projects to be monitored (where limits and quotas data will be pulled)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "monitored_folders_list" {
|
variable "monitored_folders_list" {
|
||||||
|
@ -43,9 +33,23 @@ variable "monitored_folders_list" {
|
||||||
default = []
|
default = []
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "schedule_cron" {
|
variable "monitored_projects_list" {
|
||||||
description = "Cron format schedule to run the Cloud Function. Default is every 5 minutes."
|
type = list(string)
|
||||||
default = "*/10 * * * *"
|
description = "ID of the projects to be monitored (where limits and quotas data will be pulled)"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "monitoring_project_id" {
|
||||||
|
description = "Monitoring project where the dashboard will be created and the solution deployed; a project will be created if set to empty string"
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
variable "organization_id" {
|
||||||
|
description = "The organization id for the associated services"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "prefix" {
|
||||||
|
description = "Customer name to use as prefix for monitoring project"
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "project_monitoring_services" {
|
variable "project_monitoring_services" {
|
||||||
|
@ -72,7 +76,8 @@ variable "region" {
|
||||||
description = "Region used to deploy the cloud functions and scheduler"
|
description = "Region used to deploy the cloud functions and scheduler"
|
||||||
default = "europe-west1"
|
default = "europe-west1"
|
||||||
}
|
}
|
||||||
variable "cf_version" {
|
|
||||||
description = "Cloud Function version 2nd Gen or 1st Gen. Possible options: 'V1' or 'V2'.Use CFv2 if your Cloud Function timeouts after 9 minutes. By default it is using CFv1."
|
variable "schedule_cron" {
|
||||||
default = "V1"
|
description = "Cron format schedule to run the Cloud Function. Default is every 10 minutes."
|
||||||
|
default = "*/10 * * * *"
|
||||||
}
|
}
|
|
@ -96,20 +96,20 @@ service_encryption_keys = {
|
||||||
|
|
||||||
| name | description | type | required | default |
|
| name | description | type | required | default |
|
||||||
|---|---|:---:|:---:|:---:|
|
|---|---|:---:|:---:|:---:|
|
||||||
| [prefix](variables.tf#L81) | Unique prefix used for resource names. Not used for project if 'project_create' is null. | <code>string</code> | ✓ | |
|
| [prefix](variables.tf#L78) | Unique prefix used for resource names. Not used for project if 'project_create' is null. | <code>string</code> | ✓ | |
|
||||||
| [project_id](variables.tf#L95) | Project id, references existing project if `project_create` is null. | <code>string</code> | ✓ | |
|
| [project_id](variables.tf#L92) | Project id, references existing project if `project_create` is null. | <code>string</code> | ✓ | |
|
||||||
| [composer_config](variables.tf#L17) | Composer environemnt configuration. See [attribute reference](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/composer_environment#argument-reference---cloud-composer-2) for details on settings variables. | <code title="object({ environment_size = string software_config = any workloads_config = object({ scheduler = object( { cpu = number memory_gb = number storage_gb = number count = number } ) web_server = object( { cpu = number memory_gb = number storage_gb = number } ) worker = object( { cpu = number memory_gb = number storage_gb = number min_count = number max_count = number } ) }) })">object({…})</code> | | <code title="{ environment_size = "ENVIRONMENT_SIZE_SMALL" software_config = { image_version = "composer-2-airflow-2" env_variables = { FOO = "bar" } } workloads_config = null }">{…}</code> |
|
| [composer_config](variables.tf#L17) | Composer environment configuration. It accepts only following attributes: `environment_size`, `software_config` and `workloads_config`. See [attribute reference](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/composer_environment#argument-reference---cloud-composer-2) for details on settings variables. | <code title="object({ environment_size = string software_config = any workloads_config = object({ scheduler = object( { cpu = number memory_gb = number storage_gb = number count = number } ) web_server = object( { cpu = number memory_gb = number storage_gb = number } ) worker = object( { cpu = number memory_gb = number storage_gb = number min_count = number max_count = number } ) }) })">object({…})</code> | | <code title="{ environment_size = "ENVIRONMENT_SIZE_SMALL" software_config = { image_version = "composer-2-airflow-2" } workloads_config = null }">{…}</code> |
|
||||||
| [iam_groups_map](variables.tf#L61) | Map of Role => groups to be added on the project. Example: { \"roles/composer.admin\" = [\"group:gcp-data-engineers@example.com\"]}. | <code>map(list(string))</code> | | <code>null</code> |
|
| [iam_groups_map](variables.tf#L58) | Map of Role => groups to be added on the project. Example: { \"roles/composer.admin\" = [\"group:gcp-data-engineers@example.com\"]}. | <code>map(list(string))</code> | | <code>null</code> |
|
||||||
| [network_config](variables.tf#L67) | Shared VPC network configurations to use. If null networks will be created in projects with preconfigured values. | <code title="object({ host_project = string network_self_link = string subnet_self_link = string composer_secondary_ranges = object({ pods = string services = string }) })">object({…})</code> | | <code>null</code> |
|
| [network_config](variables.tf#L64) | Shared VPC network configurations to use. If null networks will be created in projects with preconfigured values. | <code title="object({ host_project = string network_self_link = string subnet_self_link = string composer_secondary_ranges = object({ pods = string services = string }) })">object({…})</code> | | <code>null</code> |
|
||||||
| [project_create](variables.tf#L86) | Provide values if project creation is needed, uses existing project if null. Parent is in 'folders/nnn' or 'organizations/nnn' format. | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
| [project_create](variables.tf#L83) | Provide values if project creation is needed, uses existing project if null. Parent is in 'folders/nnn' or 'organizations/nnn' format. | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
||||||
| [region](variables.tf#L100) | Region where instances will be deployed. | <code>string</code> | | <code>"europe-west1"</code> |
|
| [region](variables.tf#L97) | Reagion where instances will be deployed. | <code>string</code> | | <code>"europe-west1"</code> |
|
||||||
| [service_encryption_keys](variables.tf#L106) | Cloud KMS keys to use to encrypt resources. Provide a key for each reagion in use. | <code>map(string)</code> | | <code>null</code> |
|
| [service_encryption_keys](variables.tf#L103) | Cloud KMS keys to use to encrypt resources. Provide a key for each reagion in use. | <code>map(string)</code> | | <code>null</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
| name | description | sensitive |
|
| name | description | sensitive |
|
||||||
|---|---|:---:|
|
|---|---|:---:|
|
||||||
| [composer_airflow_uri](outputs.tf#L22) | The URI of the Apache Airflow Web UI hosted within the Cloud Composer environment.. | |
|
| [composer_airflow_uri](outputs.tf#L17) | The URI of the Apache Airflow Web UI hosted within the Cloud Composer environment.. | |
|
||||||
| [composer_dag_gcs](outputs.tf#L17) | The Cloud Storage prefix of the DAGs for the Cloud Composer environment. | |
|
| [composer_dag_gcs](outputs.tf#L22) | The Cloud Storage prefix of the DAGs for the Cloud Composer environment. | |
|
||||||
|
|
||||||
<!-- END TFDOC -->
|
<!-- END TFDOC -->
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
output "composer_dag_gcs" {
|
|
||||||
description = "The Cloud Storage prefix of the DAGs for the Cloud Composer environment."
|
|
||||||
value = google_composer_environment.env.config[0].dag_gcs_prefix
|
|
||||||
}
|
|
||||||
|
|
||||||
output "composer_airflow_uri" {
|
output "composer_airflow_uri" {
|
||||||
description = "The URI of the Apache Airflow Web UI hosted within the Cloud Composer environment.."
|
description = "The URI of the Apache Airflow Web UI hosted within the Cloud Composer environment.."
|
||||||
value = google_composer_environment.env.config[0].airflow_uri
|
value = google_composer_environment.env.config[0].airflow_uri
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "composer_dag_gcs" {
|
||||||
|
description = "The Cloud Storage prefix of the DAGs for the Cloud Composer environment."
|
||||||
|
value = google_composer_environment.env.config[0].dag_gcs_prefix
|
||||||
|
}
|
||||||
|
|
|
@ -251,11 +251,11 @@ You can find examples in the `[demo](./demo)` folder.
|
||||||
| [folder_id](variables.tf#L53) | Folder to be used for the networking resources in folders/nnnn format. | <code>string</code> | ✓ | |
|
| [folder_id](variables.tf#L53) | Folder to be used for the networking resources in folders/nnnn format. | <code>string</code> | ✓ | |
|
||||||
| [organization_domain](variables.tf#L98) | Organization domain. | <code>string</code> | ✓ | |
|
| [organization_domain](variables.tf#L98) | Organization domain. | <code>string</code> | ✓ | |
|
||||||
| [prefix](variables.tf#L103) | Unique prefix used for resource names. | <code>string</code> | ✓ | |
|
| [prefix](variables.tf#L103) | Unique prefix used for resource names. | <code>string</code> | ✓ | |
|
||||||
| [composer_config](variables.tf#L22) | Cloud Composer config. | <code title="object({ node_count = number airflow_version = string env_variables = map(string) })">object({…})</code> | | <code title="{ node_count = 3 airflow_version = "composer-1.17.5-airflow-2.1.4" env_variables = {} }">{…}</code> |
|
| [composer_config](variables.tf#L22) | Cloud Composer config. | <code title="object({ node_count = number airflow_version = string env_variables = map(string) })">object({…})</code> | | <code title="{ node_count = 3 airflow_version = "composer-1-airflow-2" env_variables = {} }">{…}</code> |
|
||||||
| [data_catalog_tags](variables.tf#L36) | List of Data Catalog Policy tags to be created with optional IAM binging configuration in {tag => {ROLE => [MEMBERS]}} format. | <code>map(map(list(string)))</code> | | <code title="{ "3_Confidential" = null "2_Private" = null "1_Sensitive" = null }">{…}</code> |
|
| [data_catalog_tags](variables.tf#L36) | List of Data Catalog Policy tags to be created with optional IAM binging configuration in {tag => {ROLE => [MEMBERS]}} format. | <code>map(map(list(string)))</code> | | <code title="{ "3_Confidential" = null "2_Private" = null "1_Sensitive" = null }">{…}</code> |
|
||||||
| [data_force_destroy](variables.tf#L47) | Flag to set 'force_destroy' on data services like BiguQery or Cloud Storage. | <code>bool</code> | | <code>false</code> |
|
| [data_force_destroy](variables.tf#L47) | Flag to set 'force_destroy' on data services like BiguQery or Cloud Storage. | <code>bool</code> | | <code>false</code> |
|
||||||
| [groups](variables.tf#L64) | User groups. | <code>map(string)</code> | | <code title="{ data-analysts = "gcp-data-analysts" data-engineers = "gcp-data-engineers" data-security = "gcp-data-security" }">{…}</code> |
|
| [groups](variables.tf#L58) | User groups. | <code>map(string)</code> | | <code title="{ data-analysts = "gcp-data-analysts" data-engineers = "gcp-data-engineers" data-security = "gcp-data-security" }">{…}</code> |
|
||||||
| [location](variables.tf#L58) | Location used for multi-regional resources. | <code>string</code> | | <code>"eu"</code> |
|
| [location](variables.tf#L68) | Location used for multi-regional resources. | <code>string</code> | | <code>"eu"</code> |
|
||||||
| [network_config](variables.tf#L74) | Shared VPC network configurations to use. If null networks will be created in projects with preconfigured values. | <code title="object({ host_project = string network_self_link = string subnet_self_links = object({ load = string transformation = string orchestration = string }) composer_ip_ranges = object({ cloudsql = string gke_master = string web_server = string }) composer_secondary_ranges = object({ pods = string services = string }) })">object({…})</code> | | <code>null</code> |
|
| [network_config](variables.tf#L74) | Shared VPC network configurations to use. If null networks will be created in projects with preconfigured values. | <code title="object({ host_project = string network_self_link = string subnet_self_links = object({ load = string transformation = string orchestration = string }) composer_ip_ranges = object({ cloudsql = string gke_master = string web_server = string }) composer_secondary_ranges = object({ pods = string services = string }) })">object({…})</code> | | <code>null</code> |
|
||||||
| [project_services](variables.tf#L108) | List of core services enabled on all projects. | <code>list(string)</code> | | <code title="[ "cloudresourcemanager.googleapis.com", "iam.googleapis.com", "serviceusage.googleapis.com", "stackdriver.googleapis.com" ]">[…]</code> |
|
| [project_services](variables.tf#L108) | List of core services enabled on all projects. | <code>list(string)</code> | | <code title="[ "cloudresourcemanager.googleapis.com", "iam.googleapis.com", "serviceusage.googleapis.com", "stackdriver.googleapis.com" ]">[…]</code> |
|
||||||
| [project_suffix](variables.tf#L119) | Suffix used only for project ids. | <code>string</code> | | <code>null</code> |
|
| [project_suffix](variables.tf#L119) | Suffix used only for project ids. | <code>string</code> | | <code>null</code> |
|
||||||
|
|
|
@ -55,12 +55,6 @@ variable "folder_id" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "location" {
|
|
||||||
description = "Location used for multi-regional resources."
|
|
||||||
type = string
|
|
||||||
default = "eu"
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "groups" {
|
variable "groups" {
|
||||||
description = "User groups."
|
description = "User groups."
|
||||||
type = map(string)
|
type = map(string)
|
||||||
|
@ -71,6 +65,12 @@ variable "groups" {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "location" {
|
||||||
|
description = "Location used for multi-regional resources."
|
||||||
|
type = string
|
||||||
|
default = "eu"
|
||||||
|
}
|
||||||
|
|
||||||
variable "network_config" {
|
variable "network_config" {
|
||||||
description = "Shared VPC network configurations to use. If null networks will be created in projects with preconfigured values."
|
description = "Shared VPC network configurations to use. If null networks will be created in projects with preconfigured values."
|
||||||
type = object({
|
type = object({
|
||||||
|
|
|
@ -22,19 +22,19 @@ Repository and set the `ops_agent_image` to point to the image you built.
|
||||||
| name | description | type | required | default |
|
| name | description | type | required | default |
|
||||||
|---|---|:---:|:---:|:---:|
|
|---|---|:---:|:---:|:---:|
|
||||||
| [autoscaling_metric](variables.tf#L31) | | <code title="object({ name = string single_instance_assignment = number target = number type = string # GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE filter = string }) default = { name = "workload.googleapis.com/nginx.connections_current" single_instance_assignment = null target = 10 # Target 10 connections per instance, just for demonstration purposes type = "GAUGE" filter = null }">object({…}</code> | ✓ | |
|
| [autoscaling_metric](variables.tf#L31) | | <code title="object({ name = string single_instance_assignment = number target = number type = string # GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE filter = string }) default = { name = "workload.googleapis.com/nginx.connections_current" single_instance_assignment = null target = 10 # Target 10 connections per instance, just for demonstration purposes type = "GAUGE" filter = null }">object({…}</code> | ✓ | |
|
||||||
| [project_name](variables.tf#L106) | Name of an existing project or of the new project | <code>string</code> | ✓ | |
|
| [project_name](variables.tf#L108) | Name of an existing project or of the new project | <code>string</code> | ✓ | |
|
||||||
| [autoscaling](variables.tf#L17) | Autoscaling configuration for the instance group. | <code title="object({ min_replicas = number max_replicas = number cooldown_period = number })">object({…})</code> | | <code title="{ min_replicas = 1 max_replicas = 10 cooldown_period = 30 }">{…}</code> |
|
| [autoscaling](variables.tf#L17) | Autoscaling configuration for the instance group. | <code title="object({ min_replicas = number max_replicas = number cooldown_period = number })">object({…})</code> | | <code title="{ min_replicas = 1 max_replicas = 10 cooldown_period = 30 }">{…}</code> |
|
||||||
| [backends](variables.tf#L49) | Nginx locations configurations to proxy traffic to. | <code>string</code> | | <code title=""<<-EOT location / { proxy_pass http://10.0.16.13:80; } EOT"">"<<-EOT…EOT"</code> |
|
| [backends](variables.tf#L49) | Nginx locations configurations to proxy traffic to. | <code>string</code> | | <code title=""<<-EOT location / { proxy_pass http://10.0.16.58:80; proxy_http_version 1.1; proxy_set_header Connection ""; } EOT"">"<<-EOT…EOT"</code> |
|
||||||
| [cidrs](variables.tf#L59) | Subnet IP CIDR ranges. | <code>map(string)</code> | | <code title="{ gce = "10.0.16.0/24" }">{…}</code> |
|
| [cidrs](variables.tf#L61) | Subnet IP CIDR ranges. | <code>map(string)</code> | | <code title="{ gce = "10.0.16.0/24" }">{…}</code> |
|
||||||
| [network](variables.tf#L67) | Network name. | <code>string</code> | | <code>"reverse-proxy-vpc"</code> |
|
| [network](variables.tf#L69) | Network name. | <code>string</code> | | <code>"reverse-proxy-vpc"</code> |
|
||||||
| [network_create](variables.tf#L73) | Create network or use existing one. | <code>bool</code> | | <code>true</code> |
|
| [network_create](variables.tf#L75) | Create network or use existing one. | <code>bool</code> | | <code>true</code> |
|
||||||
| [nginx_image](variables.tf#L79) | Nginx container image to use. | <code>string</code> | | <code>"gcr.io/cloud-marketplace/google/nginx1:latest"</code> |
|
| [nginx_image](variables.tf#L81) | Nginx container image to use. | <code>string</code> | | <code>"gcr.io/cloud-marketplace/google/nginx1:latest"</code> |
|
||||||
| [ops_agent_image](variables.tf#L85) | Google Cloud Ops Agent container image to use. | <code>string</code> | | <code>"gcr.io/sfans-hub-project-d647/ops-agent:latest"</code> |
|
| [ops_agent_image](variables.tf#L87) | Google Cloud Ops Agent container image to use. | <code>string</code> | | <code>"gcr.io/sfans-hub-project-d647/ops-agent:latest"</code> |
|
||||||
| [prefix](variables.tf#L91) | Prefix used for resources that need unique names. | <code>string</code> | | <code>""</code> |
|
| [prefix](variables.tf#L93) | Prefix used for resources that need unique names. | <code>string</code> | | <code>""</code> |
|
||||||
| [project_create](variables.tf#L97) | Parameters for the creation of the new project | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
| [project_create](variables.tf#L99) | Parameters for the creation of the new project | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
||||||
| [region](variables.tf#L111) | Default region for resources. | <code>string</code> | | <code>"europe-west4"</code> |
|
| [region](variables.tf#L113) | Default region for resources. | <code>string</code> | | <code>"europe-west4"</code> |
|
||||||
| [subnetwork](variables.tf#L117) | Subnetwork name. | <code>string</code> | | <code>"gce"</code> |
|
| [subnetwork](variables.tf#L119) | Subnetwork name. | <code>string</code> | | <code>"gce"</code> |
|
||||||
| [tls](variables.tf#L123) | Also offer reverse proxying with TLS (self-signed certificate). | <code>bool</code> | | <code>false</code> |
|
| [tls](variables.tf#L125) | Also offer reverse proxying with TLS (self-signed certificate). | <code>bool</code> | | <code>false</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
|
|
|
@ -115,18 +115,19 @@ The above command will delete the associated resources so there will be no billa
|
||||||
|
|
||||||
| name | description | type | required | default |
|
| name | description | type | required | default |
|
||||||
|---|---|:---:|:---:|:---:|
|
|---|---|:---:|:---:|:---:|
|
||||||
| [project_id](variables.tf#L72) | Project id, references existing project if `project_create` is null. | <code>string</code> | ✓ | |
|
| [project_id](variables.tf#L78) | Project id, references existing project if `project_create` is null. | <code>string</code> | ✓ | |
|
||||||
| [wordpress_image](variables.tf#L83) | Image to run with Cloud Run, starts with \"gcr.io\" | <code>string</code> | ✓ | |
|
| [wordpress_image](variables.tf#L89) | Image to run with Cloud Run, starts with \"gcr.io\" | <code>string</code> | ✓ | |
|
||||||
| [cloud_run_invoker](variables.tf#L18) | IAM member authorized to access the end-point (for example, 'user:YOUR_IAM_USER' for only you or 'allUsers' for everyone) | <code>string</code> | | <code>"allUsers"</code> |
|
| [cloud_run_invoker](variables.tf#L18) | IAM member authorized to access the end-point (for example, 'user:YOUR_IAM_USER' for only you or 'allUsers' for everyone) | <code>string</code> | | <code>"allUsers"</code> |
|
||||||
| [cloudsql_password](variables.tf#L24) | CloudSQL password (will be randomly generated by default) | <code>string</code> | | <code>null</code> |
|
| [cloudsql_password](variables.tf#L24) | CloudSQL password (will be randomly generated by default) | <code>string</code> | | <code>null</code> |
|
||||||
| [create_connector](variables.tf#L30) | Should a VPC serverless connector be created or not | <code>bool</code> | | <code>true</code> |
|
| [connector](variables.tf#L30) | Existing VPC serverless connector to use if not creating a new one | <code>string</code> | | <code>null</code> |
|
||||||
| [ip_ranges](variables.tf#L37) | CIDR blocks: VPC serverless connector, Private Service Access(PSA) for CloudSQL, CloudSQL VPC | <code title="object({ connector = string psa = string sql_vpc = string })">object({…})</code> | | <code title="{ connector = "10.8.0.0/28" psa = "10.60.0.0/24" sql_vpc = "10.0.0.0/20" }">{…}</code> |
|
| [create_connector](variables.tf#L36) | Should a VPC serverless connector be created or not | <code>bool</code> | | <code>true</code> |
|
||||||
| [prefix](variables.tf#L51) | Unique prefix used for resource names. Not used for project if 'project_create' is null. | <code>string</code> | | <code>""</code> |
|
| [ip_ranges](variables.tf#L43) | CIDR blocks: VPC serverless connector, Private Service Access(PSA) for CloudSQL, CloudSQL VPC | <code title="object({ connector = string psa = string sql_vpc = string })">object({…})</code> | | <code title="{ connector = "10.8.0.0/28" psa = "10.60.0.0/24" sql_vpc = "10.0.0.0/20" }">{…}</code> |
|
||||||
| [principals](variables.tf#L57) | List of users to give rights to (CloudSQL admin, client and instanceUser, Logging admin, Service Account User and TokenCreator), eg 'user@domain.com'. | <code>list(string)</code> | | <code>[]</code> |
|
| [prefix](variables.tf#L57) | Unique prefix used for resource names. Not used for project if 'project_create' is null. | <code>string</code> | | <code>""</code> |
|
||||||
| [project_create](variables.tf#L63) | Provide values if project creation is needed, uses existing project if null. Parent is in 'folders/nnn' or 'organizations/nnn' format. | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
| [principals](variables.tf#L63) | List of users to give rights to (CloudSQL admin, client and instanceUser, Logging admin, Service Account User and TokenCreator), eg 'user@domain.com'. | <code>list(string)</code> | | <code>[]</code> |
|
||||||
| [region](variables.tf#L77) | Region for the created resources | <code>string</code> | | <code>"europe-west4"</code> |
|
| [project_create](variables.tf#L69) | Provide values if project creation is needed, uses existing project if null. Parent is in 'folders/nnn' or 'organizations/nnn' format. | <code title="object({ billing_account_id = string parent = string })">object({…})</code> | | <code>null</code> |
|
||||||
|
| [region](variables.tf#L83) | Region for the created resources | <code>string</code> | | <code>"europe-west4"</code> |
|
||||||
| [wordpress_password](variables.tf#L94) | Password for the Wordpress user (will be randomly generated by default) | <code>string</code> | | <code>null</code> |
|
| [wordpress_password](variables.tf#L94) | Password for the Wordpress user (will be randomly generated by default) | <code>string</code> | | <code>null</code> |
|
||||||
| [wordpress_port](variables.tf#L88) | Port for the Wordpress image | <code>number</code> | | <code>8080</code> |
|
| [wordpress_port](variables.tf#L100) | Port for the Wordpress image | <code>number</code> | | <code>8080</code> |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
|
@ -134,7 +135,7 @@ The above command will delete the associated resources so there will be no billa
|
||||||
|---|---|:---:|
|
|---|---|:---:|
|
||||||
| [cloud_run_service](outputs.tf#L17) | CloudRun service URL | ✓ |
|
| [cloud_run_service](outputs.tf#L17) | CloudRun service URL | ✓ |
|
||||||
| [cloudsql_password](outputs.tf#L23) | CloudSQL password | ✓ |
|
| [cloudsql_password](outputs.tf#L23) | CloudSQL password | ✓ |
|
||||||
| [wp_password](outputs.tf#L34) | Wordpress user password | ✓ |
|
| [wp_password](outputs.tf#L29) | Wordpress user password | ✓ |
|
||||||
| [wp_user](outputs.tf#L29) | Wordpress username | |
|
| [wp_user](outputs.tf#L35) | Wordpress username | |
|
||||||
|
|
||||||
<!-- END TFDOC -->
|
<!-- END TFDOC -->
|
||||||
|
|
|
@ -26,13 +26,13 @@ output "cloudsql_password" {
|
||||||
sensitive = true
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
output "wp_user" {
|
|
||||||
description = "Wordpress username"
|
|
||||||
value = local.wp_user
|
|
||||||
}
|
|
||||||
|
|
||||||
output "wp_password" {
|
output "wp_password" {
|
||||||
description = "Wordpress user password"
|
description = "Wordpress user password"
|
||||||
value = local.wp_pass
|
value = local.wp_pass
|
||||||
sensitive = true
|
sensitive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "wp_user" {
|
||||||
|
description = "Wordpress username"
|
||||||
|
value = local.wp_user
|
||||||
|
}
|
||||||
|
|
|
@ -91,14 +91,14 @@ variable "wordpress_image" {
|
||||||
description = "Image to run with Cloud Run, starts with \"gcr.io\""
|
description = "Image to run with Cloud Run, starts with \"gcr.io\""
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "wordpress_port" {
|
|
||||||
type = number
|
|
||||||
description = "Port for the Wordpress image"
|
|
||||||
default = 8080
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "wordpress_password" {
|
variable "wordpress_password" {
|
||||||
type = string
|
type = string
|
||||||
description = "Password for the Wordpress user (will be randomly generated by default)"
|
description = "Password for the Wordpress user (will be randomly generated by default)"
|
||||||
default = null
|
default = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "wordpress_port" {
|
||||||
|
type = number
|
||||||
|
description = "Port for the Wordpress image"
|
||||||
|
default = 8080
|
||||||
|
}
|
||||||
|
|
|
@ -49,15 +49,32 @@ def _check_dir(dir_name, exclude_files=None, files=False, show_extra=False):
|
||||||
try:
|
try:
|
||||||
new_doc = tfdoc.create_doc(readme_path.parent, files, show_extra,
|
new_doc = tfdoc.create_doc(readme_path.parent, files, show_extra,
|
||||||
exclude_files, readme)
|
exclude_files, readme)
|
||||||
|
variables = [v.name for v in new_doc.variables]
|
||||||
|
outputs = [v.name for v in new_doc.outputs]
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
state = state.SKIP
|
state = state.SKIP
|
||||||
else:
|
else:
|
||||||
if new_doc == result['doc']:
|
if new_doc.content == result['doc']:
|
||||||
state = State.OK
|
state = State.OK
|
||||||
|
elif variables != sorted(variables):
|
||||||
|
state = state.FAIL
|
||||||
|
diff = "\n".join([
|
||||||
|
f'----- {mod_name} variables -----',
|
||||||
|
f'variables should be in this order: ',
|
||||||
|
', '.join(sorted(variables)),
|
||||||
|
])
|
||||||
|
elif outputs != sorted(outputs):
|
||||||
|
state = state.FAIL
|
||||||
|
diff = "\n".join([
|
||||||
|
f'----- {mod_name} outputs -----',
|
||||||
|
f'outputs should be in this order: ',
|
||||||
|
', '.join(sorted(outputs)),
|
||||||
|
])
|
||||||
else:
|
else:
|
||||||
state = State.FAIL
|
state = State.FAIL
|
||||||
header = f'----- {mod_name} diff -----\n'
|
header = f'----- {mod_name} diff -----\n'
|
||||||
ndiff = difflib.ndiff(result['doc'].split('\n'), new_doc.split('\n'))
|
ndiff = difflib.ndiff(result['doc'].split('\n'),
|
||||||
|
new_doc.content.split('\n'))
|
||||||
diff = '\n'.join([header] + list(ndiff))
|
diff = '\n'.join([header] + list(ndiff))
|
||||||
yield mod_name, state, diff
|
yield mod_name, state, diff
|
||||||
|
|
||||||
|
@ -73,7 +90,7 @@ def main(dirs, exclude_file=None, files=False, show_diffs=False,
|
||||||
'Cycle through modules and ensure READMEs are up-to-date.'
|
'Cycle through modules and ensure READMEs are up-to-date.'
|
||||||
print(f'files: {files}, extra: {show_extra}, diffs: {show_diffs}\n')
|
print(f'files: {files}, extra: {show_extra}, diffs: {show_diffs}\n')
|
||||||
errors = []
|
errors = []
|
||||||
state_labels = {State.FAIL: '✗', State.OK: '✓', State.SKIP: '?'}
|
state_labels = {State.FAIL: '✗', State.OK: '✓', State.SKIP: ' '}
|
||||||
for dir_name in dirs:
|
for dir_name in dirs:
|
||||||
print(f'----- {dir_name} -----')
|
print(f'----- {dir_name} -----')
|
||||||
for mod_name, state, diff in _check_dir(dir_name, exclude_file, files,
|
for mod_name, state, diff in _check_dir(dir_name, exclude_file, files,
|
||||||
|
|
|
@ -99,13 +99,13 @@ VAR_RE = re.compile(r'''(?smx)
|
||||||
VAR_RE_TYPE = re.compile(r'([\(\{\}\)])')
|
VAR_RE_TYPE = re.compile(r'([\(\{\}\)])')
|
||||||
VAR_TEMPLATE = ('default', 'description', 'type', 'nullable')
|
VAR_TEMPLATE = ('default', 'description', 'type', 'nullable')
|
||||||
|
|
||||||
|
Document = collections.namedtuple('Document', 'content files variables outputs')
|
||||||
File = collections.namedtuple('File', 'name description modules resources')
|
File = collections.namedtuple('File', 'name description modules resources')
|
||||||
Output = collections.namedtuple(
|
Output = collections.namedtuple(
|
||||||
'Output', 'name description sensitive consumers file line')
|
'Output', 'name description sensitive consumers file line')
|
||||||
Variable = collections.namedtuple(
|
Variable = collections.namedtuple(
|
||||||
'Variable',
|
'Variable',
|
||||||
'name description type default required nullable source file line')
|
'name description type default required nullable source file line')
|
||||||
|
|
||||||
# parsing functions
|
# parsing functions
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ def format_doc(outputs, variables, files, show_extra=False):
|
||||||
|
|
||||||
def format_files(items):
|
def format_files(items):
|
||||||
'Format files table.'
|
'Format files table.'
|
||||||
items.sort(key=lambda i: i.name)
|
items = sorted(items, key=lambda i: i.name)
|
||||||
num_modules = sum(len(i.modules) for i in items)
|
num_modules = sum(len(i.modules) for i in items)
|
||||||
num_resources = sum(len(i.resources) for i in items)
|
num_resources = sum(len(i.resources) for i in items)
|
||||||
yield '| name | description |{}{}'.format(
|
yield '| name | description |{}{}'.format(
|
||||||
|
@ -271,7 +271,7 @@ def format_outputs(items, show_extra=True):
|
||||||
'Format outputs table.'
|
'Format outputs table.'
|
||||||
if not items:
|
if not items:
|
||||||
return
|
return
|
||||||
items.sort(key=lambda i: i.name)
|
items = sorted(items, key=lambda i: i.name)
|
||||||
yield '| name | description | sensitive |' + (' consumers |'
|
yield '| name | description | sensitive |' + (' consumers |'
|
||||||
if show_extra else '')
|
if show_extra else '')
|
||||||
yield '|---|---|:---:|' + ('---|' if show_extra else '')
|
yield '|---|---|:---:|' + ('---|' if show_extra else '')
|
||||||
|
@ -289,8 +289,7 @@ def format_variables(items, show_extra=True):
|
||||||
'Format variables table.'
|
'Format variables table.'
|
||||||
if not items:
|
if not items:
|
||||||
return
|
return
|
||||||
items.sort(key=lambda i: i.name)
|
items = sorted(items, key=lambda i: (not i.required, i.name))
|
||||||
items.sort(key=lambda i: i.required, reverse=True)
|
|
||||||
yield '| name | description | type | required | default |' + (
|
yield '| name | description | type | required | default |' + (
|
||||||
' producer |' if show_extra else '')
|
' producer |' if show_extra else '')
|
||||||
yield '|---|---|:---:|:---:|:---:|' + (':---:|' if show_extra else '')
|
yield '|---|---|:---:|:---:|:---:|' + (':---:|' if show_extra else '')
|
||||||
|
@ -358,7 +357,8 @@ def create_doc(module_path, files=False, show_extra=False, exclude_files=None,
|
||||||
mod_outputs = list(parse_outputs(module_path, exclude_files))
|
mod_outputs = list(parse_outputs(module_path, exclude_files))
|
||||||
except (IOError, OSError) as e:
|
except (IOError, OSError) as e:
|
||||||
raise SystemExit(e)
|
raise SystemExit(e)
|
||||||
return format_doc(mod_outputs, mod_variables, mod_files, show_extra)
|
doc = format_doc(mod_outputs, mod_variables, mod_files, show_extra)
|
||||||
|
return Document(doc, mod_files, mod_variables, mod_outputs)
|
||||||
|
|
||||||
|
|
||||||
def get_readme(readme_path):
|
def get_readme(readme_path):
|
||||||
|
@ -402,7 +402,7 @@ def main(module_path=None, exclude_file=None, files=False, replace=True,
|
||||||
readme = get_readme(readme_path)
|
readme = get_readme(readme_path)
|
||||||
doc = create_doc(module_path, files, show_extra, exclude_file, readme)
|
doc = create_doc(module_path, files, show_extra, exclude_file, readme)
|
||||||
if replace:
|
if replace:
|
||||||
replace_doc(readme_path, doc, readme)
|
replace_doc(readme_path, doc.content, readme)
|
||||||
else:
|
else:
|
||||||
print(doc)
|
print(doc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue