From 94963e8de1a10bbcb6642ef78d37d4e2ae87cb39 Mon Sep 17 00:00:00 2001 From: Alex Wang <46534502+alexwang0311@users.noreply.github.com> Date: Sun, 22 Mar 2026 19:00:44 -0700 Subject: [PATCH] Add hook into resource adoption --- templates/pkg/resource/manager.go.tpl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/templates/pkg/resource/manager.go.tpl b/templates/pkg/resource/manager.go.tpl index fde8e633..d80698b7 100644 --- a/templates/pkg/resource/manager.go.tpl +++ b/templates/pkg/resource/manager.go.tpl @@ -362,6 +362,19 @@ func (rm *resourceManager) FilterSystemTags(res acktypes.AWSResource, systemTags {{- end }} } +// OnAdopted is called after a resource has been successfully adopted and +// marked as managed. Override this behavior using the "on_adopted" hook +// in generator.yaml. The default implementation is a no-op. +func (rm *resourceManager) OnAdopted( + ctx context.Context, + res acktypes.AWSResource, +) (acktypes.AWSResource, error) { +{{- if $hookCode := Hook .CRD "on_adopted" }} +{{ $hookCode }} +{{- end }} + return res, nil +} + // mirrorAWSTags ensures that AWS tags are included in the desired resource // if they are present in the latest resource. This will ensure that the // aws tags are not present in a diff. The logic of the controller will