From c4c554876789b62d948fe59850d048be4dd99c48 Mon Sep 17 00:00:00 2001 From: Alper Rifat Ulucinar Date: Fri, 22 Dec 2023 21:13:02 +0300 Subject: [PATCH] Reconcile Environment.appconfig via the CLI Signed-off-by: Alper Rifat Ulucinar --- config/externalname.go | 6 +++--- .../appconfig/environment/zz_controller.go | 16 ++++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/config/externalname.go b/config/externalname.go index f6940b5a5d..1b8a231a73 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -1767,9 +1767,6 @@ var NoForkExternalNameConfigs = map[string]config.ExternalName{ // AppConfig Extension Associations can be imported using their extension association ID // ID is a provider-generated "aws_appconfig_extension_association": config.IdentifierFromProvider, - // AppConfig Environments can be imported by using the environment ID and application ID separated by a colon (:) - // terraform-plugin-framework - "aws_appconfig_environment": config.IdentifierFromProvider, // appintegrations // @@ -2663,6 +2660,9 @@ var CLIReconciledExternalNameConfigs = map[string]config.ExternalName{ // // SimpleDB Domains can be imported using the name "aws_simpledb_domain": config.NameAsIdentifier, + // AppConfig Environments can be imported by using the environment ID and application ID separated by a colon (:) + // terraform-plugin-framework + "aws_appconfig_environment": config.IdentifierFromProvider, } func lambdaFunctionURL() config.ExternalName { diff --git a/internal/controller/appconfig/environment/zz_controller.go b/internal/controller/appconfig/environment/zz_controller.go index 48f89bc9e3..467f9a131f 100755 --- a/internal/controller/appconfig/environment/zz_controller.go +++ b/internal/controller/appconfig/environment/zz_controller.go @@ -20,7 +20,7 @@ import ( xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" tjcontroller "github.com/crossplane/upjet/pkg/controller" "github.com/crossplane/upjet/pkg/controller/handler" - "github.com/crossplane/upjet/pkg/metrics" + "github.com/crossplane/upjet/pkg/terraform" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-aws/apis/appconfig/v1beta1" @@ -39,18 +39,14 @@ func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) } eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.Environment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter( - tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_appconfig_environment"], - tjcontroller.WithNoForkAsyncLogger(o.Logger), - tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), - tjcontroller.WithNoForkAsyncCallbackProvider(ac), - tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Environment_GroupVersionKind, mgr, o.PollInterval)), - tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["aws_appconfig_environment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), + tjcontroller.WithCallbackProvider(ac), + )), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...),