|
6 | 6 | "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/cai2hcl/common" |
7 | 7 | "github.com/GoogleCloudPlatform/terraform-google-conversion/v6/caiasset" |
8 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" |
9 | | - netsecapi "google.golang.org/api/networksecurity/v1" |
10 | 9 | ) |
11 | 10 |
|
12 | 11 | // BackendAuthenticationConfigAssetType is the CAI asset type name. |
@@ -75,20 +74,16 @@ func (c *BackendAuthenticationConfigConverter) convertResourceData(asset *caiass |
75 | 74 | func flattenBackendAuthenticationConfig(resource *caiasset.AssetResource) (map[string]any, error) { |
76 | 75 | result := make(map[string]any) |
77 | 76 |
|
78 | | - var backendAuthenticationConfig *netsecapi.BackendAuthenticationConfig |
79 | | - if err := common.DecodeJSON(resource.Data, &backendAuthenticationConfig); err != nil { |
80 | | - return nil, err |
81 | | - } |
82 | | - |
83 | | - result["name"] = flattenName(backendAuthenticationConfig.Name) |
84 | | - result["labels"] = backendAuthenticationConfig.Labels |
85 | | - result["description"] = backendAuthenticationConfig.Description |
86 | | - result["client_certificate"] = backendAuthenticationConfig.ClientCertificate |
87 | | - result["trust_config"] = backendAuthenticationConfig.TrustConfig |
88 | | - result["well_known_roots"] = backendAuthenticationConfig.WellKnownRoots |
89 | | - result["project"] = flattenProjectName(backendAuthenticationConfig.Name) |
| 77 | + resourceData := resource.Data |
90 | 78 |
|
91 | | - result["location"] = resource.Location |
| 79 | + result["name"] = flattenName(resourceData["name"].(string)) |
| 80 | + result["labels"] = resourceData["labels"] |
| 81 | + result["description"] = resourceData["description"] |
| 82 | + result["client_certificate"] = resourceData["clientCertificate"] |
| 83 | + result["trust_config"] = resourceData["trustConfig"] |
| 84 | + result["well_known_roots"] = resourceData["wellKnownRoots"] |
| 85 | + result["project"] = flattenProjectName(resourceData["name"].(string)) |
| 86 | + result["location"] = flattenLocation(resourceData["name"].(string)) |
92 | 87 |
|
93 | 88 | return result, nil |
94 | 89 | } |
0 commit comments