Skip to content

Commit 6748f63

Browse files
Allow multiple cai asset names for one resource in tgc metadata model (#14090) (#23074)
[upstream:b7f1b38e066464840c67b03b1f4ce93884bf0777] Signed-off-by: Modular Magician <[email protected]>
1 parent 121e40b commit 6748f63

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

google/acctest/tgc_utils.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
)
3131

3232
type ResourceMetadata struct {
33-
CaiAssetName string `json:"cai_asset_name"`
33+
CaiAssetNames []string `json:"cai_asset_names"`
3434
ResourceType string `json:"resource_type"`
3535
ResourceAddress string `json:"resource_address"`
3636
ImportMetadata ImportMetadata `json:"import_metadata,omitempty"`
@@ -86,7 +86,7 @@ func CollectAllTgcMetadata(tgcPayload TgcMetadataPayload) resource.TestCheckFunc
8686
apiServiceName := GetAPIServiceNameForResource(metadata.ResourceType)
8787
if apiServiceName == "unknown" || apiServiceName == "failed_to_populate_metadata_cache" {
8888
log.Printf("[DEBUG]TGC Terraform error: unknown resource type %s", metadata.ResourceType)
89-
metadata.CaiAssetName = apiServiceName
89+
metadata.CaiAssetNames = []string{apiServiceName}
9090
} else {
9191
var rName string
9292
switch metadata.ResourceType {
@@ -95,7 +95,7 @@ func CollectAllTgcMetadata(tgcPayload TgcMetadataPayload) resource.TestCheckFunc
9595
default:
9696
rName = rState.Primary.ID
9797
}
98-
metadata.CaiAssetName = fmt.Sprintf("//%s/%s", apiServiceName, rName)
98+
metadata.CaiAssetNames = []string{fmt.Sprintf("//%s/%s", apiServiceName, rName)}
9999
}
100100

101101
// Resolve auto IDs in import metadata
@@ -238,7 +238,7 @@ func extendWithTGCData(t *testing.T, c resource.TestCase) resource.TestCase {
238238
ResourceAddress: res,
239239
ImportMetadata: importMeta,
240240
Service: GetServicePackageForResourceType(resourceType),
241-
// CaiAssetName will be populated at runtime in the check function
241+
// CaiAssetNames will be populated at runtime in the check function
242242
}
243243
}
244244
}

0 commit comments

Comments
 (0)