From 0847d9fc08371020e41c12a85750ff396df63bef Mon Sep 17 00:00:00 2001 From: Shay Yannay Date: Sat, 8 Jun 2024 23:14:29 +0300 Subject: [PATCH] fix resource policy external name Signed-off-by: Shay Yannay --- config/externalname.go | 2 +- internal/controller/dynamodb/resourcepolicy/zz_controller.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/externalname.go b/config/externalname.go index 87ffe7bf0d..7418fae4dd 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -71,7 +71,7 @@ var TerraformPluginFrameworkExternalNameConfigs = map[string]config.ExternalName // dynamodb // // DynamoDB table resource policy can be important using the DynamoDB resource identifier - "aws_dynamodb_resource_policy": config.IdentifierFromProvider, + "aws_dynamodb_resource_policy": config.TemplatedStringAsIdentifier("name", "arn:aws:dynamodb:{{ .setup.configuration.region }}:{{ .setup.client_metadata.account_id }}:table/{{ .external_name }}"), // CodeGuru Profiler // Profiling Group can be imported using the the profiling group name diff --git a/internal/controller/dynamodb/resourcepolicy/zz_controller.go b/internal/controller/dynamodb/resourcepolicy/zz_controller.go index 335002b78c..c49f50dd8a 100755 --- a/internal/controller/dynamodb/resourcepolicy/zz_controller.go +++ b/internal/controller/dynamodb/resourcepolicy/zz_controller.go @@ -29,6 +29,7 @@ import ( func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { name := managed.ControllerName(v1beta1.ResourcePolicy_GroupVersionKind.String()) var initializers managed.InitializerChain + initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} if o.SecretStoreConfigGVK != nil { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig)))