From 0971d23c2ba0494d3d082537285580f834063911 Mon Sep 17 00:00:00 2001 From: Matt Bush Date: Mon, 29 Jul 2024 13:35:03 -0700 Subject: [PATCH] Rename new external name function Signed-off-by: Matt Bush --- config/externalname.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/externalname.go b/config/externalname.go index 2b96cd763d..f52febb7f0 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -1111,9 +1111,9 @@ var TerraformPluginSDKExternalNameConfigs = map[string]config.ExternalName{ // eks // // import EKS access entry using the cluster_name and principal_arn separated by a colon (:). - "aws_eks_access_entry": FormattedIdentifierFromProviderWithIdentifierFields(":", "cluster_name", "principal_arn"), + "aws_eks_access_entry": FormattedIdentifierFromParameters(":", "cluster_name", "principal_arn"), // import EKS access entry using the cluster_name principal_arn and policy_arn separated by a (#) which the tf provider docs incorrectly describe as a colon. - "aws_eks_access_policy_association": FormattedIdentifierFromProviderWithIdentifierFields("#", "cluster_name", "principal_arn", "policy_arn"), + "aws_eks_access_policy_association": FormattedIdentifierFromParameters("#", "cluster_name", "principal_arn", "policy_arn"), // "aws_eks_addon": config.TemplatedStringAsIdentifier("addon_name", "{{ .parameters.cluster_name }}:{{ .external_name }}"), // my_cluster:my_eks_addon "aws_eks_addon": FormattedIdentifierFromProvider(":", "cluster_name", "addon_name"), @@ -2975,7 +2975,7 @@ func getPermissionSetId(tfstate map[string]any) (string, error) { // But that would remove them from spec.initProvider, which would be a breaking schema change for existing resources // that we don't have a good way to handle yet. // -// For new resources, prefer using FormattedIdentifierFromProviderWithIdentifierFields instead. +// For new resources, prefer using FormattedIdentifierFromParameters instead. func FormattedIdentifierFromProvider(separator string, keys ...string) config.ExternalName { e := config.IdentifierFromProvider e.GetIDFn = func(_ context.Context, _ string, parameters map[string]interface{}, _ map[string]interface{}) (string, error) { @@ -2996,14 +2996,14 @@ func FormattedIdentifierFromProvider(separator string, keys ...string) config.Ex return e } -// FormattedIdentifierFromProviderWithIdentifierFields is a helper function to construct Terraform -// IDs that use elements from the parameters in a certain string format. +// FormattedIdentifierFromParameters is a helper function to construct Terraform +// IDs that use elements from the parameters joined by some separator string. // It should be used in cases where all information in the ID is gathered from // the spec and not user defined like name. For example, zone_id:vpc_id. // This function sets the keys as IdentifierFields, which means that they are always required, even for observe-only // resources. Because the id is constructed exclusively from the keys, omitting them (even if the external name // annotation is set) leaves the provider unable to find the terraform id to use to observe the resource. -func FormattedIdentifierFromProviderWithIdentifierFields(separator string, keys ...string) config.ExternalName { +func FormattedIdentifierFromParameters(separator string, keys ...string) config.ExternalName { e := FormattedIdentifierFromProvider(separator, keys...) e.IdentifierFields = append(e.IdentifierFields, keys...) return e