@@ -10,7 +10,6 @@ import (
1010 "text/template"
1111
1212 "github.com/doublecloud/go-genproto/doublecloud/clickhouse/v1"
13- "github.com/hashicorp/terraform-plugin-framework/attr"
1413 "github.com/hashicorp/terraform-plugin-framework/types"
1514 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
1615)
@@ -121,18 +120,24 @@ func TestAccClickhouseClusterResource(t *testing.T) {
121120 }
122121
123122 m4 := m3
124- cc , _ := types .ObjectValue (map [string ]attr.Type {
125- "certificate" : types .StringType ,
126- "key" : types .StringType ,
127- "root_ca" : types .StringType ,
128- },
129- map [string ]attr.Value {
130- "certificate" : types .StringValue (testAccClickhouseTLSCert ),
131- "key" : types .StringValue (testAccClickhouseTLSKey ),
132- "root_ca" : types .StringValue (testAccClickhouseTLSRootCA ),
123+ /*
124+ cc, _ := types.ObjectValue(map[string]attr.Type{
125+ "certificate": types.StringType,
126+ "key": types.StringType,
127+ "root_ca": types.StringType,
133128 },
134- )
135- m4 .CustomCertificate = cc
129+ map[string]attr.Value{
130+ "certificate": types.StringValue(testAccClickhouseTLSCert),
131+ "key": types.StringValue(testAccClickhouseTLSKey),
132+ "root_ca": types.StringValue(testAccClickhouseTLSRootCA),
133+ },
134+ )
135+ */
136+ m4 .CustomCertificate = & clickhouseCustomCertificate {
137+ Certificate : types .StringValue (testAccClickhouseTLSCert ),
138+ Key : types .StringValue (testAccClickhouseTLSKey ),
139+ RootCA : types .StringValue (testAccClickhouseTLSRootCA ),
140+ }
136141
137142 resource .Test (t , resource.TestCase {
138143 PreCheck : func () { testAccPreCheck (t ) },
@@ -159,6 +164,10 @@ func TestAccClickhouseClusterResource(t *testing.T) {
159164 resource .TestCheckResourceAttr (testAccClickhouseId , "private_connection_info.user" , "admin" ),
160165 resource .TestCheckResourceAttr (testAccClickhouseId , "private_connection_info.https_port" , "8443" ),
161166 resource .TestCheckResourceAttr (testAccClickhouseId , "private_connection_info.tcp_port_secure" , "9440" ),
167+ resource .TestCheckResourceAttr (testAccClickhouseId , "connection_info.https_port_ctls" , "0" ),
168+ resource .TestCheckResourceAttr (testAccClickhouseId , "connection_info.tcp_port_secure_ctls" , "0" ),
169+ resource .TestCheckResourceAttr (testAccClickhouseId , "private_connection_info.https_port_ctls" , "0" ),
170+ resource .TestCheckResourceAttr (testAccClickhouseId , "private_connection_info.tcp_port_secure_ctls" , "0" ),
162171 ),
163172 },
164173 // Update and Read testing
@@ -197,6 +206,10 @@ func TestAccClickhouseClusterResource(t *testing.T) {
197206 resource .TestCheckResourceAttr (testAccClickhouseId , "custom_certificate.certificate" , testAccClickhouseTLSCert ),
198207 resource .TestCheckResourceAttr (testAccClickhouseId , "custom_certificate.key" , testAccClickhouseTLSKey ),
199208 resource .TestCheckResourceAttr (testAccClickhouseId , "custom_certificate.root_ca" , testAccClickhouseTLSRootCA ),
209+ resource .TestCheckResourceAttr (testAccClickhouseId , "connection_info.https_port_ctls" , "8444" ),
210+ resource .TestCheckResourceAttr (testAccClickhouseId , "connection_info.tcp_port_secure_ctls" , "9444" ),
211+ resource .TestCheckResourceAttr (testAccClickhouseId , "private_connection_info.https_port_ctls" , "8444" ),
212+ resource .TestCheckResourceAttr (testAccClickhouseId , "private_connection_info.tcp_port_secure_ctls" , "9444" ),
200213 ),
201214 },
202215 // Delete testing automatically occurs in TestCase
@@ -338,11 +351,11 @@ resource "doublecloud_clickhouse_cluster" "tf-acc-clickhouse" {
338351 ]
339352 {{- end}}
340353 }
341- {{- if not .CustomCertificate.IsNull }}
354+ {{- if ne .CustomCertificate nil }}
342355 custom_certificate {
343- certificate = {{ .CustomCertificate.Attributes.certificate }}
344- key = {{ .CustomCertificate.Attributes.key }}
345- root_ca = {{ .CustomCertificate.Attributes.root_ca }}
356+ certificate = {{ .CustomCertificate.Certificate }}
357+ key = {{ .CustomCertificate.Key }}
358+ root_ca = {{ .CustomCertificate.RootCA }}
346359 }
347360 {{- end}}
348361 }`
0 commit comments