diff --git a/internal/resources/tests/add-mtls_test.go b/internal/resources/tests/add-mtls_test.go index 01304e9..9795bc4 100644 --- a/internal/resources/tests/add-mtls_test.go +++ b/internal/resources/tests/add-mtls_test.go @@ -77,7 +77,7 @@ func TestAccWebApplicationAssetWithmTLSBasic(t *testing.T) { "source_identifier.1.values.#": "1", "source_identifier.0.values.#": "1", "source_identifier.0.values_ids.#": "1", - "proxy_setting.#": "6", //was 3 + "proxy_setting.#": "3", //was 3 "proxy_setting.0.%": "3", "proxy_setting.1.%": "3", "proxy_setting.2.%": "3", @@ -95,9 +95,15 @@ func TestAccWebApplicationAssetWithmTLSBasic(t *testing.T) { "tags.0.key": "tagkey1", "tags.0.value": "tagvalue1", - "proxy_setting.3.%": "3", - "proxy_setting.4.%": "3", - "proxy_setting.5.%": "3", + //"proxy_setting.3.%": "3", + //"proxy_setting.4.%": "3", + //"proxy_setting.5.%": "3", + + "mtls.#": "1", + "mtls.0.filename": "cert.pem", + "mtls.0.data": "cert data", + "mtls.0.type": "client", + "mtls.0.enable": "true", }), resource.TestCheckResourceAttrSet(assetResourceName, "id"), resource.TestCheckResourceAttrSet(assetResourceName, "practice.0.id"), @@ -111,6 +117,9 @@ func TestAccWebApplicationAssetWithmTLSBasic(t *testing.T) { resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path2", assetNameAttribute)), resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path3", assetNameAttribute)), resource.TestCheckResourceAttrSet(assetResourceName, "tags.0.id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.filename_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.data_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.enable_id"), )..., ), ExpectNonEmptyPlan: true, @@ -177,7 +186,7 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) { "source_identifier.1.values.#": "1", "source_identifier.0.values.#": "1", "source_identifier.0.values_ids.#": "1", - "proxy_setting.#": "6", //was 3 + "proxy_setting.#": "3", //was 3 "proxy_setting.0.%": "3", "proxy_setting.1.%": "3", "proxy_setting.2.%": "3", @@ -197,9 +206,15 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) { "tags.1.key": "tagkey2", "tags.1.value": "tagvalue2", - "proxy_setting.3.%": "3", - "proxy_setting.4.%": "3", - "proxy_setting.5.%": "3", + //"proxy_setting.3.%": "3", + //"proxy_setting.4.%": "3", + //"proxy_setting.5.%": "3", + + "mtls.#": "1", + "mtls.0.filename": "cert.pem", + "mtls.0.data": "cert data", + "mtls.0.type": "client", + "mtls.0.enable": "true", }), resource.TestCheckResourceAttrSet(assetResourceName, "id"), resource.TestCheckResourceAttrSet(assetResourceName, "practice.0.id"), @@ -209,13 +224,17 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) { resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.0.id"), resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.1.id"), resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.2.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"), resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path1", assetNameAttribute)), resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path2", assetNameAttribute)), resource.TestCheckResourceAttrSet(assetResourceName, "tags.0.id"), resource.TestCheckResourceAttrSet(assetResourceName, "tags.1.id"), + + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.filename_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.data_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.enable_id"), )..., ), ExpectNonEmptyPlan: true, @@ -278,12 +297,22 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) { "tags.2.key": "tagkey3", "tags.2.value": "tagvalue3", - "proxy_setting.3.%": "3", - "proxy_setting.4.%": "3", - "proxy_setting.5.%": "3", - "proxy_setting.6.%": "3", - "proxy_setting.7.%": "3", - "proxy_setting.8.%": "3", + //"proxy_setting.3.%": "3", + //"proxy_setting.4.%": "3", + //"proxy_setting.5.%": "3", + //"proxy_setting.6.%": "3", + //"proxy_setting.7.%": "3", + //"proxy_setting.8.%": "3", + + "mtls.#": "2", + "mtls.0.filename": "newfile.pem", + "mtls.0.data": "new cert data", + "mtls.0.type": "server", + "mtls.0.enable": "true", + "mtls.1.filename": "newfile2.pem", + "mtls.1.data": "new cert data2", + "mtls.1.type": "client", + "mtls.1.enable": "false", }), resource.TestCheckResourceAttrSet(assetResourceName, "id"), resource.TestCheckResourceAttrSet(assetResourceName, "practice.0.id"), @@ -293,17 +322,24 @@ func TestAccWebApplicationAssetWithmTLSFull(t *testing.T) { resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.0.id"), resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.1.id"), resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.2.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.6.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.7.id"), - resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.8.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.3.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.4.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.5.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.6.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.7.id"), + //resource.TestCheckResourceAttrSet(assetResourceName, "proxy_setting.8.id"), resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path3", assetNameAttribute)), resource.TestCheckTypeSetElemAttr(assetResourceName, "urls.*", fmt.Sprintf("http://host/%s/path4", assetNameAttribute)), resource.TestCheckResourceAttrSet(assetResourceName, "tags.0.id"), resource.TestCheckResourceAttrSet(assetResourceName, "tags.1.id"), resource.TestCheckResourceAttrSet(assetResourceName, "tags.2.id"), + + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.filename_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.data_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.0.enable_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.1.filename_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.1.data_id"), + resource.TestCheckResourceAttrSet(assetResourceName, "mtls.1.enable_id"), )..., ), ExpectNonEmptyPlan: true,