From 9334d8f358fdcefb71fc0e9e3fc28f3139a80bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Czoma?= Date: Tue, 19 Mar 2024 10:00:07 -0400 Subject: [PATCH] Testing fixes [skip ci] --- ci/module-test/main.tf | 52 +++++++++++++++++++++++++++--- ci/template-test/main.tf | 14 ++++---- examples/basic-vpn/README.md | 2 +- examples/basic-vpn/main.tf | 16 +-------- internal/gen-template/main.tf | 2 +- internal/gen-template/outputs.tf | 4 +-- internal/gen-template/variables.tf | 18 +++++------ 7 files changed, 68 insertions(+), 40 deletions(-) diff --git a/ci/module-test/main.tf b/ci/module-test/main.tf index 86ff463..e899365 100644 --- a/ci/module-test/main.tf +++ b/ci/module-test/main.tf @@ -6,6 +6,7 @@ provider "solacebroker" { module "testvpn" { source = "../.." + # version = "" msg_vpn_name = "testvpn" acl_profile_name = "testvpn-acl-profile" @@ -34,21 +35,61 @@ module "testvpn" { cert_matching_rule_name = "testvpnCertMatchingRule" cert_matching_rule_conditions = [ { - source = "issuer" + source = "issuer" expression = "C = CA, ST = Ontario, L = Kanata, O = Solace Systems, OU = IT, CN = *.messaging.solace" } ] cert_matching_rule_attribute_filters = [ { - filter_name = "testFilter" - attribute_name = "username" + filter_name = "testFilter" + attribute_name = "username" attribute_value = "test" } ] + authentication_kerberos_enabled = true +} + +output "created_msg_vpn" { + value = module.testvpn.msg_vpn + sensitive = true +} + +output "created_acl_profile" { + value = module.testvpn.acl_profile +} + +output "created_client_profile" { + value = module.testvpn.client_profile +} + +output "created_oauth_profile" { + value = module.testvpn.oauth_profile + sensitive = true +} + +output "created_oauth_profile_client_required_claims" { + value = module.testvpn.oauth_profile_client_required_claims +} + +output "created_oauth_profile_resource_server_required_claims" { + value = module.testvpn.oauth_profile_resource_server_required_claims +} + +output "created_cert_matching_rule" { + value = module.testvpn.cert_matching_rule +} + +output "created_cert_matching_rule_conditions" { + value = module.testvpn.cert_matching_rule_conditions +} + +output "created_cert_matching_rule_attribute_filters" { + value = module.testvpn.cert_matching_rule_attribute_filters } module "testvpn2" { source = "../.." + # version = "" msg_vpn_name = "testvpn2" acl_profile_name = "testvpn-acl-profile2" @@ -57,7 +98,8 @@ module "testvpn2" { module "defaultvpn" { source = "../.." + # version = "" - msg_vpn_name = "default" - enabled = false + msg_vpn_name = "default" + enabled = false } diff --git a/ci/template-test/main.tf b/ci/template-test/main.tf index 8108c83..0c27234 100644 --- a/ci/template-test/main.tf +++ b/ci/template-test/main.tf @@ -34,21 +34,21 @@ module "testvpn" { cert_matching_rule_name = "testvpnCertMatchingRule" cert_matching_rule_conditions = [ { - source = "issuer" + source = "issuer" expression = "C = CA, ST = Ontario, L = Kanata, O = Solace Systems, OU = IT, CN = *.messaging.solace" } ] cert_matching_rule_attribute_filters = [ { - filter_name = "testFilter" - attribute_name = "username" + filter_name = "testFilter" + attribute_name = "username" attribute_value = "test" } ] } output "created_msg_vpn" { - value = module.testvpn.msg_vpn + value = module.testvpn.msg_vpn sensitive = true } @@ -61,7 +61,7 @@ output "created_client_profile" { } output "created_oauth_profile" { - value = module.testvpn.oauth_profile + value = module.testvpn.oauth_profile sensitive = true } @@ -96,6 +96,6 @@ module "testvpn2" { module "defaultvpn" { source = "../../internal/gen-template" - msg_vpn_name = "default" - enabled = false + msg_vpn_name = "default" + enabled = false } diff --git a/examples/basic-vpn/README.md b/examples/basic-vpn/README.md index d979375..b31bf1b 100644 --- a/examples/basic-vpn/README.md +++ b/examples/basic-vpn/README.md @@ -68,7 +68,7 @@ terraform plan terraform apply ``` -Run `terraform destroy` to clean up created resources when no longer needed. +Run `terraform destroy` to clean up created resources when no longer needed. Note that as part of this command there may be a warning about default objects cannot be deleted, this is normal and expected here. ## Additional Documentation diff --git a/examples/basic-vpn/main.tf b/examples/basic-vpn/main.tf index b52d203..c3b5c76 100644 --- a/examples/basic-vpn/main.tf +++ b/examples/basic-vpn/main.tf @@ -1,17 +1,3 @@ -# Copyright 2024 Solace Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - provider "solacebroker" { username = "admin" password = "admin" @@ -21,7 +7,7 @@ provider "solacebroker" { module "testvpn" { source = "../.." - msg_vpn_name = "myvpn" + msg_vpn_name = "myvpn" // No need to set the VPN enabled, it defaults to true // enabled = true diff --git a/internal/gen-template/main.tf b/internal/gen-template/main.tf index 923c66b..0e478e9 100644 --- a/internal/gen-template/main.tf +++ b/internal/gen-template/main.tf @@ -2,7 +2,7 @@ locals { oauth_profile_client_required_claims_list = tolist(var.oauth_profile_client_required_claims) oauth_profile_resource_server_required_claims_list = tolist(var.oauth_profile_resource_server_required_claims) cert_matching_rule_conditions_list = tolist(var.cert_matching_rule_conditions) - cert_matching_rule_attribute_filters_list = tolist(var.cert_matching_rule_attribute_filters) + cert_matching_rule_attribute_filters_list = tolist(var.cert_matching_rule_attribute_filters) } resource "solacebroker_msg_vpn" "main" { diff --git a/internal/gen-template/outputs.tf b/internal/gen-template/outputs.tf index 09e41b9..3c0c889 100644 --- a/internal/gen-template/outputs.tf +++ b/internal/gen-template/outputs.tf @@ -1,7 +1,7 @@ # Output variable definitions output "msg_vpn" { - value = try(solacebroker_msg_vpn.main, null) + value = try(solacebroker_msg_vpn.main, null) sensitive = true } @@ -14,7 +14,7 @@ output "client_profile" { } output "oauth_profile" { - value = try(solacebroker_msg_vpn_authentication_oauth_profile.main, null) + value = try(solacebroker_msg_vpn_authentication_oauth_profile.main, null) sensitive = true } diff --git a/internal/gen-template/variables.tf b/internal/gen-template/variables.tf index 957647e..d24ec61 100644 --- a/internal/gen-template/variables.tf +++ b/internal/gen-template/variables.tf @@ -98,30 +98,30 @@ variable "oauth_profile_client_required_claims" { variable "oauth_profile_resource_server_required_claims" { description = "Additional claims to be verified in the access token. Ignored if `oauth_profile_name` is not set" - type = set(object({ + type = set(object({ claim_name = string claim_value = string })) - default = [] + default = [] } variable "cert_matching_rule_conditions" { description = "The conditions to be added to the Certification Matching Rule. Ignored if `cert_matching_rule_name` is not set" - type = set(object({ - source = string + type = set(object({ + source = string expression = string })) - default = [] + default = [] } variable "cert_matching_rule_attribute_filters" { description = "The filters to be added to the Certification Matching Rule. A Cert Matching Rule Attribute Filter compares a username attribute to a string. Ignored if `cert_matching_rule_name` is not set" - type = set(object({ - filter_name = string - attribute_name = string + type = set(object({ + filter_name = string + attribute_name = string attribute_value = string })) - default = [] + default = [] } #AutoAddAttributes