Standardise reuse variable from project module and implement for net-vpc (#3205)
* exposing the network_id from the net-vpc module for use with tag bindings * convert vpc_create to vpc_reuse * Changed the reuse vars to standardised attributes * fixed readme tests and schemas * modified apigee blueprint to use vpc_reuse with network_id passthrough --------- Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -45,11 +45,11 @@ locals {
|
||||
parent = null
|
||||
prefix = null
|
||||
project_reuse = merge({
|
||||
use_data_source = true
|
||||
project_attributes = null
|
||||
use_data_source = true
|
||||
attributes = null
|
||||
}, try(local._projects_config.data_defaults.project_reuse, {
|
||||
use_data_source = true
|
||||
project_attributes = null
|
||||
use_data_source = true
|
||||
attributes = null
|
||||
})
|
||||
)
|
||||
service_encryption_key_ids = {}
|
||||
@@ -220,8 +220,8 @@ locals {
|
||||
try(v.project_reuse, null) != null
|
||||
? merge(
|
||||
{
|
||||
use_data_source = true
|
||||
project_attributes = null
|
||||
use_data_source = true
|
||||
attributes = null
|
||||
},
|
||||
v.project_reuse
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"use_data_source": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"project_attributes": {
|
||||
"attributes": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
- **project_reuse**: *object*
|
||||
<br>*additional properties: false*
|
||||
- **use_data_source**: *boolean*
|
||||
- **project_attributes**: *object*
|
||||
- **attributes**: *object*
|
||||
- ⁺**name**: *string*
|
||||
- ⁺**number**: *number*
|
||||
- **services_enabled**: *array*
|
||||
|
||||
@@ -385,7 +385,7 @@ variable "project_reuse" {
|
||||
description = "Reuse existing project if not null. If name and number are not passed in, a data source is used."
|
||||
type = object({
|
||||
use_data_source = optional(bool, true)
|
||||
project_attributes = optional(object({
|
||||
attributes = optional(object({
|
||||
name = string
|
||||
number = number
|
||||
services_enabled = optional(list(string), [])
|
||||
@@ -395,8 +395,8 @@ variable "project_reuse" {
|
||||
validation {
|
||||
condition = (
|
||||
try(var.project_reuse.use_data_source, null) != false ||
|
||||
try(var.project_reuse.project_attributes, null) != null
|
||||
try(var.project_reuse.attributes, null) != null
|
||||
)
|
||||
error_message = "Reuse datasource can be disabled only if project attributes are set."
|
||||
error_message = "Reuse datasource can be disabled only if attributes are set."
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user