Skip to content

Commit 8eb33ce

Browse files
Update validation prechecks (#213)
1 parent 95ee3e1 commit 8eb33ce

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

terraform/modules/compute/bastion/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ variable "compartment_id" {
1818
type = string
1919
description = "The OCID of the compartment where the bastion instance will be created"
2020
validation {
21-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
22-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
21+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
22+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
2323
}
2424
}
2525

terraform/modules/fss/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compartment_id" {
55
type = string
66
description = "The OCID of the compartment where the file system exists"
77
validation {
8-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
9-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
8+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
9+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1010
}
1111
}
1212

terraform/modules/lb/loadbalancer/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compartment_id" {
55
type = string
66
description = "The OCID of the compartment where the load balancer will be created"
77
validation {
8-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
9-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
8+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
9+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1010
}
1111
}
1212

terraform/modules/network/subnet/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compartment_id" {
55
type = string
66
description = "The OCID of the compartment where the subnet will be created"
77
validation {
8-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
9-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
8+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
9+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1010
}
1111
}
1212

terraform/modules/network/vcn-config/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compartment_id" {
55
type = string
66
description = "The OCID of the compartment where the vcn config will be created"
77
validation {
8-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
9-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
8+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
9+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1010
}
1111
}
1212

terraform/modules/network/vcn-peering/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ variable "wls_network_compartment_id" {
1010
type = string
1111
description = "The OCID of the compartment for the network resources, like VCN, for the WebLogic servers"
1212
validation {
13-
condition = length(regexall("^ocid1.compartment.*$", var.wls_network_compartment_id)) > 0
14-
error_message = "WLSC-ERROR: The value for wls_network_compartment_id should start with \"ocid1.compartment.\"."
13+
condition = length(regexall("^ocid1.compartment.*$", var.wls_network_compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.wls_network_compartment_id)) > 0
14+
error_message = "WLSC-ERROR: The value for wls_network_compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1515
}
1616
}
1717

terraform/modules/network/vcn/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compartment_id" {
55
type = string
66
description = "The OCID of the compartment where the VCN will be created"
77
validation {
8-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
9-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
8+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
9+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1010
}
1111
}
1212

terraform/modules/policies/variables.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,35 @@ variable "compartment_id" {
1414
type = string
1515
description = "The OCID of the compartment for the matching rule of dynamic group"
1616
validation {
17-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
18-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
17+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
18+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1919
}
2020
}
2121

2222
variable "network_compartment_id" {
2323
type = string
2424
description = "The OCID of the compartment where the network resources like VCN are located"
2525
validation {
26-
condition = length(regexall("^ocid1.compartment.*$", var.network_compartment_id)) > 0
27-
error_message = "WLSC-ERROR: The value for network_compartment_id should start with \"ocid1.compartment.\"."
26+
condition = length(regexall("^ocid1.compartment.*$", var.network_compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.network_compartment_id)) > 0
27+
error_message = "WLSC-ERROR: The value for network_compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
2828
}
2929
}
3030

3131
variable "fss_compartment_id" {
3232
type = string
3333
description = "The OCID of the compartment where the file system exists"
3434
validation {
35-
condition = length(regexall("^ocid1.compartment.*$", var.fss_compartment_id)) > 0
36-
error_message = "WLSC-ERROR: The value for fss_compartment_id should start with \"ocid1.compartment.\"."
35+
condition = length(regexall("^ocid1.compartment.*$", var.fss_compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.fss_compartment_id)) > 0
36+
error_message = "WLSC-ERROR: The value for fss_compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
3737
}
3838
}
3939

4040
variable "mount_target_compartment_id" {
4141
type = string
4242
description = "The OCID of the compartment where the mount target exists"
4343
validation {
44-
condition = length(regexall("^ocid1.compartment.*$", var.mount_target_compartment_id)) > 0
45-
error_message = "WLSC-ERROR: The value for mount_target_compartment_id should start with \"ocid1.compartment.\"."
44+
condition = length(regexall("^ocid1.compartment.*$", var.mount_target_compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.mount_target_compartment_id)) > 0
45+
error_message = "WLSC-ERROR: The value for mount_target_compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
4646
}
4747
}
4848

terraform/modules/resource-tags/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compartment_id" {
55
type = string
66
description = "The OCID of the compartment where the resource tags will be created"
77
validation {
8-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
9-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
8+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
9+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1010
}
1111
}
1212

terraform/modules/rms-private-endpoint/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ variable "compartment_id" {
55
type = string
66
description = "The OCID of the compartment where the file system exists"
77
validation {
8-
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0
9-
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\"."
8+
condition = length(regexall("^ocid1.compartment.*$", var.compartment_id)) > 0 || length(regexall("^ocid1.tenancy.*$", var.compartment_id)) > 0
9+
error_message = "WLSC-ERROR: The value for compartment_id should start with \"ocid1.compartment.\" or \"ocid1.tenancy.\"."
1010
}
1111
}
1212

0 commit comments

Comments
 (0)