diff --git a/provider/resources.go b/provider/resources.go index c629e890fa7..84dc17ed1cb 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -5911,6 +5911,8 @@ func ProviderFromMeta(metaInfo *tfbridge.MetadataInfo) *tfbridge.ProviderInfo { prov.MustApplyAutoAliases() + setupComputedIDs(&prov) + return &prov } @@ -6041,3 +6043,33 @@ func hasNonComputedTagsAndTagsAll(tfResourceName string, res shim.Resource) bool } return true } + +func setupComputedIDs(prov *tfbridge.ProviderInfo) { + attr := func(state resource.PropertyMap, attrs ...resource.PropertyKey) resource.ID { + parts := []string{} + for _, a := range attrs { + if v, ok := state[a]; ok { + if v.IsString() && v.StringValue() != "" { + parts = append(parts, v.StringValue()) + } + } + } + s := strings.Join(parts, "__") + if s == "" { + s = "id" + } + return resource.ID(s) + } + prov.Resources["aws_lambda_runtime_management_config"].ComputeID = func(ctx context.Context, state resource.PropertyMap) (resource.ID, error) { + return attr(state, "functionName", "qualifier"), nil + } + prov.Resources["aws_datazone_environment_blueprint_configuration"].ComputeID = func(ctx context.Context, state resource.PropertyMap) (resource.ID, error) { + return attr(state, "domainId", "environmentBlueprintId"), nil + } + prov.Resources["aws_vpc_endpoint_service_private_dns_verification"].ComputeID = func(ctx context.Context, state resource.PropertyMap) (resource.ID, error) { + return attr(state, "serviceId"), nil + } + prov.Resources["aws_vpc_endpoint_private_dns"].ComputeID = func(ctx context.Context, state resource.PropertyMap) (resource.ID, error) { + return attr(state, "vpcEndpointId"), nil + } +}