diff --git a/apis/accesscontextmanager/v1beta1/zz_generated_terraformed.go b/apis/accesscontextmanager/v1beta1/zz_generated_terraformed.go index 4cfba696b..fc742f4f6 100755 --- a/apis/accesscontextmanager/v1beta1/zz_generated_terraformed.go +++ b/apis/accesscontextmanager/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AccessLevel) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AccessLevel +func (tr *AccessLevel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AccessLevel using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AccessLevel) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *AccessLevelCondition) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AccessLevelCondition +func (tr *AccessLevelCondition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AccessLevelCondition using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AccessLevelCondition) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *AccessPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AccessPolicy +func (tr *AccessPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AccessPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AccessPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *AccessPolicyIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AccessPolicyIAMMember +func (tr *AccessPolicyIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AccessPolicyIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AccessPolicyIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *ServicePerimeter) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServicePerimeter +func (tr *ServicePerimeter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServicePerimeter using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServicePerimeter) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *ServicePerimeterResource) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServicePerimeterResource +func (tr *ServicePerimeterResource) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServicePerimeterResource using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServicePerimeterResource) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/activedirectory/v1beta1/zz_generated_terraformed.go b/apis/activedirectory/v1beta1/zz_generated_terraformed.go index 54ed3b8bf..66cb0735f 100755 --- a/apis/activedirectory/v1beta1/zz_generated_terraformed.go +++ b/apis/activedirectory/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Domain) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Domain +func (tr *Domain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Domain using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Domain) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/alloydb/v1beta1/zz_generated_terraformed.go b/apis/alloydb/v1beta1/zz_generated_terraformed.go index 2f0fdd631..af8abd61d 100755 --- a/apis/alloydb/v1beta1/zz_generated_terraformed.go +++ b/apis/alloydb/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Backup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Backup +func (tr *Backup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Backup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Backup) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Cluster) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Cluster using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/apigee/v1beta1/zz_generated_terraformed.go b/apis/apigee/v1beta1/zz_generated_terraformed.go index ea22d1481..c847baf80 100755 --- a/apis/apigee/v1beta1/zz_generated_terraformed.go +++ b/apis/apigee/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Envgroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Envgroup +func (tr *Envgroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Envgroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Envgroup) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Environment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Environment +func (tr *Environment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Environment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Environment) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *EnvironmentIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this EnvironmentIAMMember +func (tr *EnvironmentIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this EnvironmentIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *EnvironmentIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *NATAddress) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NATAddress +func (tr *NATAddress) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NATAddress using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NATAddress) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *Organization) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Organization +func (tr *Organization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Organization using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Organization) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/appengine/v1beta1/zz_generated_terraformed.go b/apis/appengine/v1beta1/zz_generated_terraformed.go index 068c7f27a..5c99aaf57 100755 --- a/apis/appengine/v1beta1/zz_generated_terraformed.go +++ b/apis/appengine/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Application) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Application +func (tr *Application) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Application using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Application) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *ApplicationURLDispatchRules) GetInitParameters() (map[string]any, erro return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ApplicationURLDispatchRules +func (tr *ApplicationURLDispatchRules) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ApplicationURLDispatchRules using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ApplicationURLDispatchRules) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *FirewallRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FirewallRule +func (tr *FirewallRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FirewallRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FirewallRule) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *ServiceNetworkSettings) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServiceNetworkSettings +func (tr *ServiceNetworkSettings) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServiceNetworkSettings using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServiceNetworkSettings) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *StandardAppVersion) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this StandardAppVersion +func (tr *StandardAppVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this StandardAppVersion using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *StandardAppVersion) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/artifact/v1beta1/zz_generated_terraformed.go b/apis/artifact/v1beta1/zz_generated_terraformed.go index 9ce80c762..2bbe581fb 100755 --- a/apis/artifact/v1beta1/zz_generated_terraformed.go +++ b/apis/artifact/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *RegistryRepository) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegistryRepository +func (tr *RegistryRepository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegistryRepository using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegistryRepository) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *RegistryRepositoryIAMMember) GetInitParameters() (map[string]any, erro return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegistryRepositoryIAMMember +func (tr *RegistryRepositoryIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegistryRepositoryIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegistryRepositoryIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/beyondcorp/v1beta1/zz_generated_terraformed.go b/apis/beyondcorp/v1beta1/zz_generated_terraformed.go index 0586a09ae..d097a48ca 100755 --- a/apis/beyondcorp/v1beta1/zz_generated_terraformed.go +++ b/apis/beyondcorp/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AppConnection) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AppConnection +func (tr *AppConnection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AppConnection using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AppConnection) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *AppConnector) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AppConnector +func (tr *AppConnector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AppConnector using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AppConnector) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *AppGateway) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AppGateway +func (tr *AppGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AppGateway using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AppGateway) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/bigquery/v1beta1/zz_generated_terraformed.go b/apis/bigquery/v1beta1/zz_generated_terraformed.go index 36ab81dbf..dcc8d865a 100755 --- a/apis/bigquery/v1beta1/zz_generated_terraformed.go +++ b/apis/bigquery/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AnalyticsHubDataExchange) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AnalyticsHubDataExchange +func (tr *AnalyticsHubDataExchange) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AnalyticsHubDataExchange using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AnalyticsHubDataExchange) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *AnalyticsHubDataExchangeIAMMember) GetInitParameters() (map[string]any return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AnalyticsHubDataExchangeIAMMember +func (tr *AnalyticsHubDataExchangeIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AnalyticsHubDataExchangeIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AnalyticsHubDataExchangeIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *AnalyticsHubListing) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AnalyticsHubListing +func (tr *AnalyticsHubListing) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AnalyticsHubListing using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AnalyticsHubListing) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *Connection) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Connection +func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Connection using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *DataTransferConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DataTransferConfig +func (tr *DataTransferConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DataTransferConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DataTransferConfig) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *Dataset) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Dataset +func (tr *Dataset) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Dataset using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Dataset) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *DatasetAccess) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DatasetAccess +func (tr *DatasetAccess) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DatasetAccess using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DatasetAccess) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *DatasetIAMBinding) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DatasetIAMBinding +func (tr *DatasetIAMBinding) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DatasetIAMBinding using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DatasetIAMBinding) LateInitialize(attrs []byte) (bool, error) { @@ -767,6 +1008,36 @@ func (tr *DatasetIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DatasetIAMMember +func (tr *DatasetIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DatasetIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DatasetIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -851,6 +1122,36 @@ func (tr *DatasetIAMPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DatasetIAMPolicy +func (tr *DatasetIAMPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DatasetIAMPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DatasetIAMPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -935,6 +1236,36 @@ func (tr *Job) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Job +func (tr *Job) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Job using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Job) LateInitialize(attrs []byte) (bool, error) { @@ -1019,6 +1350,36 @@ func (tr *Reservation) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Reservation +func (tr *Reservation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Reservation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Reservation) LateInitialize(attrs []byte) (bool, error) { @@ -1103,6 +1464,36 @@ func (tr *ReservationAssignment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ReservationAssignment +func (tr *ReservationAssignment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ReservationAssignment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ReservationAssignment) LateInitialize(attrs []byte) (bool, error) { @@ -1187,6 +1578,36 @@ func (tr *Routine) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Routine +func (tr *Routine) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Routine using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Routine) LateInitialize(attrs []byte) (bool, error) { @@ -1271,6 +1692,36 @@ func (tr *Table) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Table +func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Table using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Table) LateInitialize(attrs []byte) (bool, error) { @@ -1355,6 +1806,36 @@ func (tr *TableIAMBinding) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TableIAMBinding +func (tr *TableIAMBinding) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TableIAMBinding using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TableIAMBinding) LateInitialize(attrs []byte) (bool, error) { @@ -1439,6 +1920,36 @@ func (tr *TableIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TableIAMMember +func (tr *TableIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TableIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TableIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -1523,6 +2034,36 @@ func (tr *TableIAMPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TableIAMPolicy +func (tr *TableIAMPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TableIAMPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TableIAMPolicy) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/bigtable/v1beta1/zz_generated_terraformed.go b/apis/bigtable/v1beta1/zz_generated_terraformed.go index 4fcea6a66..7d8bc64aa 100755 --- a/apis/bigtable/v1beta1/zz_generated_terraformed.go +++ b/apis/bigtable/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AppProfile) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AppProfile +func (tr *AppProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AppProfile using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AppProfile) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *GarbageCollectionPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this GarbageCollectionPolicy +func (tr *GarbageCollectionPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this GarbageCollectionPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *GarbageCollectionPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *InstanceIAMBinding) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceIAMBinding +func (tr *InstanceIAMBinding) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceIAMBinding using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceIAMBinding) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *InstanceIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceIAMMember +func (tr *InstanceIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *InstanceIAMPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceIAMPolicy +func (tr *InstanceIAMPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceIAMPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceIAMPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *Table) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Table +func (tr *Table) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Table using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Table) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *TableIAMBinding) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TableIAMBinding +func (tr *TableIAMBinding) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TableIAMBinding using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TableIAMBinding) LateInitialize(attrs []byte) (bool, error) { @@ -767,6 +1008,36 @@ func (tr *TableIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TableIAMMember +func (tr *TableIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TableIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TableIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -851,6 +1122,36 @@ func (tr *TableIAMPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TableIAMPolicy +func (tr *TableIAMPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TableIAMPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TableIAMPolicy) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/binaryauthorization/v1beta1/zz_generated_terraformed.go b/apis/binaryauthorization/v1beta1/zz_generated_terraformed.go index 742fa15bb..224487966 100755 --- a/apis/binaryauthorization/v1beta1/zz_generated_terraformed.go +++ b/apis/binaryauthorization/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Attestor) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Attestor +func (tr *Attestor) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Attestor using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Attestor) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Policy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Policy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/certificatemanager/v1beta1/zz_generated_terraformed.go b/apis/certificatemanager/v1beta1/zz_generated_terraformed.go index fe6192a38..4280db3e4 100755 --- a/apis/certificatemanager/v1beta1/zz_generated_terraformed.go +++ b/apis/certificatemanager/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Certificate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Certificate +func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Certificate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *CertificateMap) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CertificateMap +func (tr *CertificateMap) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CertificateMap using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CertificateMap) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *CertificateMapEntry) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CertificateMapEntry +func (tr *CertificateMapEntry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CertificateMapEntry using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CertificateMapEntry) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *DNSAuthorization) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DNSAuthorization +func (tr *DNSAuthorization) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DNSAuthorization using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DNSAuthorization) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloud/v1beta1/zz_generated_terraformed.go b/apis/cloud/v1beta1/zz_generated_terraformed.go index 6ca77b515..ef2e5770c 100755 --- a/apis/cloud/v1beta1/zz_generated_terraformed.go +++ b/apis/cloud/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *IdsEndpoint) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this IdsEndpoint +func (tr *IdsEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this IdsEndpoint using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *IdsEndpoint) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudbuild/v1beta1/zz_generated_terraformed.go b/apis/cloudbuild/v1beta1/zz_generated_terraformed.go index a7dba8562..cb89a94e7 100755 --- a/apis/cloudbuild/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudbuild/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Trigger) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Trigger +func (tr *Trigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Trigger using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Trigger) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *WorkerPool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WorkerPool +func (tr *WorkerPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WorkerPool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WorkerPool) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudfunctions/v1beta1/zz_generated_terraformed.go b/apis/cloudfunctions/v1beta1/zz_generated_terraformed.go index 8960cc8ba..d612b39ff 100755 --- a/apis/cloudfunctions/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudfunctions/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Function) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Function +func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Function using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Function) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *FunctionIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FunctionIAMMember +func (tr *FunctionIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FunctionIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FunctionIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudfunctions2/v1beta1/zz_generated_terraformed.go b/apis/cloudfunctions2/v1beta1/zz_generated_terraformed.go index 4bda8c310..7f5241925 100755 --- a/apis/cloudfunctions2/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudfunctions2/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Function) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Function +func (tr *Function) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Function using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Function) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudiot/v1beta1/zz_generated_terraformed.go b/apis/cloudiot/v1beta1/zz_generated_terraformed.go index 0651f7651..fc308f29f 100755 --- a/apis/cloudiot/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudiot/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Device) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Device +func (tr *Device) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Device using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Device) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Registry) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Registry +func (tr *Registry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Registry using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Registry) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudplatform/v1beta1/zz_generated_terraformed.go b/apis/cloudplatform/v1beta1/zz_generated_terraformed.go index c73639a8f..29406545c 100755 --- a/apis/cloudplatform/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudplatform/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Folder) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Folder +func (tr *Folder) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Folder using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Folder) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *FolderIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FolderIAMMember +func (tr *FolderIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FolderIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FolderIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *OrganizationIAMAuditConfig) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this OrganizationIAMAuditConfig +func (tr *OrganizationIAMAuditConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this OrganizationIAMAuditConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *OrganizationIAMAuditConfig) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *OrganizationIAMCustomRole) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this OrganizationIAMCustomRole +func (tr *OrganizationIAMCustomRole) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this OrganizationIAMCustomRole using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *OrganizationIAMCustomRole) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *OrganizationIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this OrganizationIAMMember +func (tr *OrganizationIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this OrganizationIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *OrganizationIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *Project) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Project +func (tr *Project) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Project using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Project) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *ProjectDefaultServiceAccounts) GetInitParameters() (map[string]any, er return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectDefaultServiceAccounts +func (tr *ProjectDefaultServiceAccounts) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectDefaultServiceAccounts using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectDefaultServiceAccounts) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *ProjectIAMAuditConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectIAMAuditConfig +func (tr *ProjectIAMAuditConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectIAMAuditConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectIAMAuditConfig) LateInitialize(attrs []byte) (bool, error) { @@ -767,6 +1008,36 @@ func (tr *ProjectIAMCustomRole) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectIAMCustomRole +func (tr *ProjectIAMCustomRole) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectIAMCustomRole using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectIAMCustomRole) LateInitialize(attrs []byte) (bool, error) { @@ -851,6 +1122,36 @@ func (tr *ProjectIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectIAMMember +func (tr *ProjectIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -935,6 +1236,36 @@ func (tr *ProjectService) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectService +func (tr *ProjectService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectService using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectService) LateInitialize(attrs []byte) (bool, error) { @@ -1019,6 +1350,36 @@ func (tr *ProjectUsageExportBucket) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectUsageExportBucket +func (tr *ProjectUsageExportBucket) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectUsageExportBucket using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectUsageExportBucket) LateInitialize(attrs []byte) (bool, error) { @@ -1103,6 +1464,36 @@ func (tr *ServiceAccount) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServiceAccount +func (tr *ServiceAccount) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServiceAccount using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServiceAccount) LateInitialize(attrs []byte) (bool, error) { @@ -1187,6 +1578,36 @@ func (tr *ServiceAccountIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServiceAccountIAMMember +func (tr *ServiceAccountIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServiceAccountIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServiceAccountIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -1271,6 +1692,36 @@ func (tr *ServiceAccountKey) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServiceAccountKey +func (tr *ServiceAccountKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServiceAccountKey using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServiceAccountKey) LateInitialize(attrs []byte) (bool, error) { @@ -1355,6 +1806,36 @@ func (tr *ServiceNetworkingPeeredDNSDomain) GetInitParameters() (map[string]any, return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServiceNetworkingPeeredDNSDomain +func (tr *ServiceNetworkingPeeredDNSDomain) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServiceNetworkingPeeredDNSDomain using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServiceNetworkingPeeredDNSDomain) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudrun/v1beta1/zz_generated_terraformed.go b/apis/cloudrun/v1beta1/zz_generated_terraformed.go index 040bb3586..24a202dce 100755 --- a/apis/cloudrun/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudrun/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *DomainMapping) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DomainMapping +func (tr *DomainMapping) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DomainMapping using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DomainMapping) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Service) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Service +func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Service using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Service) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *ServiceIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServiceIAMMember +func (tr *ServiceIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServiceIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServiceIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *V2Job) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this V2Job +func (tr *V2Job) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this V2Job using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *V2Job) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *V2Service) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this V2Service +func (tr *V2Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this V2Service using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *V2Service) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudscheduler/v1beta1/zz_generated_terraformed.go b/apis/cloudscheduler/v1beta1/zz_generated_terraformed.go index 77ab80946..f9c9f87cb 100755 --- a/apis/cloudscheduler/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudscheduler/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Job) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Job +func (tr *Job) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Job using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Job) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cloudtasks/v1beta1/zz_generated_terraformed.go b/apis/cloudtasks/v1beta1/zz_generated_terraformed.go index ae3e600ae..85c3298ef 100755 --- a/apis/cloudtasks/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudtasks/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Queue) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Queue +func (tr *Queue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Queue using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Queue) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/composer/v1beta1/zz_generated_terraformed.go b/apis/composer/v1beta1/zz_generated_terraformed.go index 1b2760f70..79f52bc43 100755 --- a/apis/composer/v1beta1/zz_generated_terraformed.go +++ b/apis/composer/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Environment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Environment +func (tr *Environment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Environment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Environment) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/compute/v1beta1/zz_generated_terraformed.go b/apis/compute/v1beta1/zz_generated_terraformed.go index 0ed7c6540..0ca8e7e81 100755 --- a/apis/compute/v1beta1/zz_generated_terraformed.go +++ b/apis/compute/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Address) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Address +func (tr *Address) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Address using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Address) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *AttachedDisk) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AttachedDisk +func (tr *AttachedDisk) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AttachedDisk using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AttachedDisk) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Autoscaler) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Autoscaler +func (tr *Autoscaler) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Autoscaler using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Autoscaler) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *BackendBucket) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BackendBucket +func (tr *BackendBucket) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BackendBucket using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BackendBucket) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *BackendBucketSignedURLKey) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BackendBucketSignedURLKey +func (tr *BackendBucketSignedURLKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BackendBucketSignedURLKey using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BackendBucketSignedURLKey) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *BackendService) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BackendService +func (tr *BackendService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BackendService using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BackendService) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *BackendServiceSignedURLKey) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BackendServiceSignedURLKey +func (tr *BackendServiceSignedURLKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BackendServiceSignedURLKey using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BackendServiceSignedURLKey) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *Disk) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Disk +func (tr *Disk) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Disk using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Disk) LateInitialize(attrs []byte) (bool, error) { @@ -767,6 +1008,36 @@ func (tr *DiskIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DiskIAMMember +func (tr *DiskIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DiskIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DiskIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -851,6 +1122,36 @@ func (tr *DiskResourcePolicyAttachment) GetInitParameters() (map[string]any, err return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DiskResourcePolicyAttachment +func (tr *DiskResourcePolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DiskResourcePolicyAttachment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DiskResourcePolicyAttachment) LateInitialize(attrs []byte) (bool, error) { @@ -935,6 +1236,36 @@ func (tr *ExternalVPNGateway) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ExternalVPNGateway +func (tr *ExternalVPNGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ExternalVPNGateway using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ExternalVPNGateway) LateInitialize(attrs []byte) (bool, error) { @@ -1019,6 +1350,36 @@ func (tr *Firewall) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Firewall +func (tr *Firewall) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Firewall using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Firewall) LateInitialize(attrs []byte) (bool, error) { @@ -1103,6 +1464,36 @@ func (tr *FirewallPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FirewallPolicy +func (tr *FirewallPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FirewallPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FirewallPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -1187,6 +1578,36 @@ func (tr *FirewallPolicyAssociation) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FirewallPolicyAssociation +func (tr *FirewallPolicyAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FirewallPolicyAssociation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FirewallPolicyAssociation) LateInitialize(attrs []byte) (bool, error) { @@ -1271,6 +1692,36 @@ func (tr *FirewallPolicyRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FirewallPolicyRule +func (tr *FirewallPolicyRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FirewallPolicyRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FirewallPolicyRule) LateInitialize(attrs []byte) (bool, error) { @@ -1355,6 +1806,36 @@ func (tr *ForwardingRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ForwardingRule +func (tr *ForwardingRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ForwardingRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ForwardingRule) LateInitialize(attrs []byte) (bool, error) { @@ -1439,6 +1920,36 @@ func (tr *GlobalAddress) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this GlobalAddress +func (tr *GlobalAddress) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this GlobalAddress using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *GlobalAddress) LateInitialize(attrs []byte) (bool, error) { @@ -1523,6 +2034,36 @@ func (tr *GlobalForwardingRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this GlobalForwardingRule +func (tr *GlobalForwardingRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this GlobalForwardingRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *GlobalForwardingRule) LateInitialize(attrs []byte) (bool, error) { @@ -1607,6 +2148,36 @@ func (tr *GlobalNetworkEndpoint) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this GlobalNetworkEndpoint +func (tr *GlobalNetworkEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this GlobalNetworkEndpoint using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *GlobalNetworkEndpoint) LateInitialize(attrs []byte) (bool, error) { @@ -1691,14 +2262,44 @@ func (tr *GlobalNetworkEndpointGroup) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } -// LateInitialize this GlobalNetworkEndpointGroup using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *GlobalNetworkEndpointGroup) LateInitialize(attrs []byte) (bool, error) { - params := &GlobalNetworkEndpointGroupParameters{} - if err := json.TFParser.Unmarshal(attrs, params); err != nil { - return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") +// GetInitParameters of this GlobalNetworkEndpointGroup +func (tr *GlobalNetworkEndpointGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) } - opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this GlobalNetworkEndpointGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *GlobalNetworkEndpointGroup) LateInitialize(attrs []byte) (bool, error) { + params := &GlobalNetworkEndpointGroupParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} li := resource.NewGenericLateInitializer(opts...) return li.LateInitialize(&tr.Spec.ForProvider, params) @@ -1775,6 +2376,36 @@ func (tr *HaVPNGateway) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this HaVPNGateway +func (tr *HaVPNGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this HaVPNGateway using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *HaVPNGateway) LateInitialize(attrs []byte) (bool, error) { @@ -1859,6 +2490,36 @@ func (tr *HealthCheck) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this HealthCheck +func (tr *HealthCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this HealthCheck using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *HealthCheck) LateInitialize(attrs []byte) (bool, error) { @@ -1943,6 +2604,36 @@ func (tr *HTTPHealthCheck) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this HTTPHealthCheck +func (tr *HTTPHealthCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this HTTPHealthCheck using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *HTTPHealthCheck) LateInitialize(attrs []byte) (bool, error) { @@ -2027,6 +2718,36 @@ func (tr *HTTPSHealthCheck) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this HTTPSHealthCheck +func (tr *HTTPSHealthCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this HTTPSHealthCheck using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *HTTPSHealthCheck) LateInitialize(attrs []byte) (bool, error) { @@ -2111,6 +2832,36 @@ func (tr *Image) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Image +func (tr *Image) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Image using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Image) LateInitialize(attrs []byte) (bool, error) { @@ -2195,6 +2946,36 @@ func (tr *ImageIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ImageIAMMember +func (tr *ImageIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ImageIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ImageIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -2279,6 +3060,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { @@ -2363,6 +3174,36 @@ func (tr *InstanceFromTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceFromTemplate +func (tr *InstanceFromTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceFromTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceFromTemplate) LateInitialize(attrs []byte) (bool, error) { @@ -2447,6 +3288,36 @@ func (tr *InstanceGroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceGroup +func (tr *InstanceGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceGroup) LateInitialize(attrs []byte) (bool, error) { @@ -2531,6 +3402,36 @@ func (tr *InstanceGroupManager) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceGroupManager +func (tr *InstanceGroupManager) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceGroupManager using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceGroupManager) LateInitialize(attrs []byte) (bool, error) { @@ -2615,6 +3516,36 @@ func (tr *InstanceGroupNamedPort) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceGroupNamedPort +func (tr *InstanceGroupNamedPort) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceGroupNamedPort using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceGroupNamedPort) LateInitialize(attrs []byte) (bool, error) { @@ -2699,6 +3630,36 @@ func (tr *InstanceIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceIAMMember +func (tr *InstanceIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -2783,6 +3744,36 @@ func (tr *InstanceTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceTemplate +func (tr *InstanceTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceTemplate) LateInitialize(attrs []byte) (bool, error) { @@ -2867,6 +3858,36 @@ func (tr *InterconnectAttachment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InterconnectAttachment +func (tr *InterconnectAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InterconnectAttachment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InterconnectAttachment) LateInitialize(attrs []byte) (bool, error) { @@ -2951,6 +3972,36 @@ func (tr *ManagedSSLCertificate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ManagedSSLCertificate +func (tr *ManagedSSLCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ManagedSSLCertificate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ManagedSSLCertificate) LateInitialize(attrs []byte) (bool, error) { @@ -3035,6 +4086,36 @@ func (tr *Network) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Network +func (tr *Network) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Network using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Network) LateInitialize(attrs []byte) (bool, error) { @@ -3119,6 +4200,36 @@ func (tr *NetworkEndpoint) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NetworkEndpoint +func (tr *NetworkEndpoint) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NetworkEndpoint using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NetworkEndpoint) LateInitialize(attrs []byte) (bool, error) { @@ -3203,6 +4314,36 @@ func (tr *NetworkEndpointGroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NetworkEndpointGroup +func (tr *NetworkEndpointGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NetworkEndpointGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NetworkEndpointGroup) LateInitialize(attrs []byte) (bool, error) { @@ -3287,10 +4428,40 @@ func (tr *NetworkFirewallPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } -// LateInitialize this NetworkFirewallPolicy using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *NetworkFirewallPolicy) LateInitialize(attrs []byte) (bool, error) { - params := &NetworkFirewallPolicyParameters{} +// GetInitParameters of this NetworkFirewallPolicy +func (tr *NetworkFirewallPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this NetworkFirewallPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *NetworkFirewallPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &NetworkFirewallPolicyParameters{} if err := json.TFParser.Unmarshal(attrs, params); err != nil { return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") } @@ -3371,6 +4542,36 @@ func (tr *NetworkFirewallPolicyAssociation) GetInitParameters() (map[string]any, return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NetworkFirewallPolicyAssociation +func (tr *NetworkFirewallPolicyAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NetworkFirewallPolicyAssociation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NetworkFirewallPolicyAssociation) LateInitialize(attrs []byte) (bool, error) { @@ -3455,6 +4656,36 @@ func (tr *NetworkPeering) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NetworkPeering +func (tr *NetworkPeering) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NetworkPeering using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NetworkPeering) LateInitialize(attrs []byte) (bool, error) { @@ -3539,6 +4770,36 @@ func (tr *NetworkPeeringRoutesConfig) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NetworkPeeringRoutesConfig +func (tr *NetworkPeeringRoutesConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NetworkPeeringRoutesConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NetworkPeeringRoutesConfig) LateInitialize(attrs []byte) (bool, error) { @@ -3623,6 +4884,36 @@ func (tr *NodeGroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NodeGroup +func (tr *NodeGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NodeGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NodeGroup) LateInitialize(attrs []byte) (bool, error) { @@ -3707,6 +4998,36 @@ func (tr *NodeTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NodeTemplate +func (tr *NodeTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NodeTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NodeTemplate) LateInitialize(attrs []byte) (bool, error) { @@ -3791,6 +5112,36 @@ func (tr *PacketMirroring) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this PacketMirroring +func (tr *PacketMirroring) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this PacketMirroring using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *PacketMirroring) LateInitialize(attrs []byte) (bool, error) { @@ -3875,6 +5226,36 @@ func (tr *PerInstanceConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this PerInstanceConfig +func (tr *PerInstanceConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this PerInstanceConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *PerInstanceConfig) LateInitialize(attrs []byte) (bool, error) { @@ -3959,6 +5340,36 @@ func (tr *ProjectDefaultNetworkTier) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectDefaultNetworkTier +func (tr *ProjectDefaultNetworkTier) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectDefaultNetworkTier using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectDefaultNetworkTier) LateInitialize(attrs []byte) (bool, error) { @@ -4043,6 +5454,36 @@ func (tr *ProjectMetadata) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectMetadata +func (tr *ProjectMetadata) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectMetadata using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectMetadata) LateInitialize(attrs []byte) (bool, error) { @@ -4127,6 +5568,36 @@ func (tr *ProjectMetadataItem) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectMetadataItem +func (tr *ProjectMetadataItem) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectMetadataItem using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectMetadataItem) LateInitialize(attrs []byte) (bool, error) { @@ -4211,6 +5682,36 @@ func (tr *RegionAutoscaler) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionAutoscaler +func (tr *RegionAutoscaler) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionAutoscaler using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionAutoscaler) LateInitialize(attrs []byte) (bool, error) { @@ -4295,6 +5796,36 @@ func (tr *RegionBackendService) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionBackendService +func (tr *RegionBackendService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionBackendService using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionBackendService) LateInitialize(attrs []byte) (bool, error) { @@ -4379,6 +5910,36 @@ func (tr *RegionDisk) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionDisk +func (tr *RegionDisk) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionDisk using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionDisk) LateInitialize(attrs []byte) (bool, error) { @@ -4463,6 +6024,36 @@ func (tr *RegionDiskIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionDiskIAMMember +func (tr *RegionDiskIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionDiskIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionDiskIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -4547,6 +6138,36 @@ func (tr *RegionDiskResourcePolicyAttachment) GetInitParameters() (map[string]an return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionDiskResourcePolicyAttachment +func (tr *RegionDiskResourcePolicyAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionDiskResourcePolicyAttachment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionDiskResourcePolicyAttachment) LateInitialize(attrs []byte) (bool, error) { @@ -4631,6 +6252,36 @@ func (tr *RegionHealthCheck) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionHealthCheck +func (tr *RegionHealthCheck) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionHealthCheck using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionHealthCheck) LateInitialize(attrs []byte) (bool, error) { @@ -4715,6 +6366,36 @@ func (tr *RegionInstanceGroupManager) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionInstanceGroupManager +func (tr *RegionInstanceGroupManager) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionInstanceGroupManager using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionInstanceGroupManager) LateInitialize(attrs []byte) (bool, error) { @@ -4799,6 +6480,36 @@ func (tr *RegionNetworkEndpointGroup) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionNetworkEndpointGroup +func (tr *RegionNetworkEndpointGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionNetworkEndpointGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionNetworkEndpointGroup) LateInitialize(attrs []byte) (bool, error) { @@ -4883,6 +6594,36 @@ func (tr *RegionNetworkFirewallPolicy) GetInitParameters() (map[string]any, erro return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionNetworkFirewallPolicy +func (tr *RegionNetworkFirewallPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionNetworkFirewallPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionNetworkFirewallPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -4967,6 +6708,36 @@ func (tr *RegionNetworkFirewallPolicyAssociation) GetInitParameters() (map[strin return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionNetworkFirewallPolicyAssociation +func (tr *RegionNetworkFirewallPolicyAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionNetworkFirewallPolicyAssociation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionNetworkFirewallPolicyAssociation) LateInitialize(attrs []byte) (bool, error) { @@ -5051,6 +6822,36 @@ func (tr *RegionPerInstanceConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionPerInstanceConfig +func (tr *RegionPerInstanceConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionPerInstanceConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionPerInstanceConfig) LateInitialize(attrs []byte) (bool, error) { @@ -5135,6 +6936,36 @@ func (tr *RegionSSLCertificate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionSSLCertificate +func (tr *RegionSSLCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionSSLCertificate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionSSLCertificate) LateInitialize(attrs []byte) (bool, error) { @@ -5219,6 +7050,36 @@ func (tr *RegionTargetHTTPProxy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionTargetHTTPProxy +func (tr *RegionTargetHTTPProxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionTargetHTTPProxy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionTargetHTTPProxy) LateInitialize(attrs []byte) (bool, error) { @@ -5303,6 +7164,36 @@ func (tr *RegionTargetHTTPSProxy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionTargetHTTPSProxy +func (tr *RegionTargetHTTPSProxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionTargetHTTPSProxy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionTargetHTTPSProxy) LateInitialize(attrs []byte) (bool, error) { @@ -5387,6 +7278,36 @@ func (tr *RegionURLMap) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RegionURLMap +func (tr *RegionURLMap) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RegionURLMap using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RegionURLMap) LateInitialize(attrs []byte) (bool, error) { @@ -5471,6 +7392,36 @@ func (tr *Reservation) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Reservation +func (tr *Reservation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Reservation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Reservation) LateInitialize(attrs []byte) (bool, error) { @@ -5555,6 +7506,36 @@ func (tr *ResourcePolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ResourcePolicy +func (tr *ResourcePolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ResourcePolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ResourcePolicy) LateInitialize(attrs []byte) (bool, error) { @@ -5639,6 +7620,36 @@ func (tr *Route) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Route +func (tr *Route) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Route using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Route) LateInitialize(attrs []byte) (bool, error) { @@ -5723,6 +7734,36 @@ func (tr *Router) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Router +func (tr *Router) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Router using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Router) LateInitialize(attrs []byte) (bool, error) { @@ -5807,6 +7848,36 @@ func (tr *RouterInterface) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RouterInterface +func (tr *RouterInterface) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RouterInterface using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RouterInterface) LateInitialize(attrs []byte) (bool, error) { @@ -5891,6 +7962,36 @@ func (tr *RouterNAT) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RouterNAT +func (tr *RouterNAT) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RouterNAT using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RouterNAT) LateInitialize(attrs []byte) (bool, error) { @@ -5975,6 +8076,36 @@ func (tr *RouterPeer) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RouterPeer +func (tr *RouterPeer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RouterPeer using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RouterPeer) LateInitialize(attrs []byte) (bool, error) { @@ -6046,17 +8177,47 @@ func (tr *SecurityPolicy) SetParameters(params map[string]any) error { if err != nil { return err } - return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) -} + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this SecurityPolicy +func (tr *SecurityPolicy) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this SecurityPolicy +func (tr *SecurityPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } -// GetInitParameters of this SecurityPolicy -func (tr *SecurityPolicy) GetInitParameters() (map[string]any, error) { - p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) if err != nil { - return nil, err + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) } - base := map[string]any{} - return base, json.TFParser.Unmarshal(p, &base) + + return params, nil } // LateInitialize this SecurityPolicy using its observed tfState. @@ -6143,6 +8304,36 @@ func (tr *ServiceAttachment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServiceAttachment +func (tr *ServiceAttachment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServiceAttachment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServiceAttachment) LateInitialize(attrs []byte) (bool, error) { @@ -6227,6 +8418,36 @@ func (tr *SharedVPCHostProject) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SharedVPCHostProject +func (tr *SharedVPCHostProject) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SharedVPCHostProject using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SharedVPCHostProject) LateInitialize(attrs []byte) (bool, error) { @@ -6311,6 +8532,36 @@ func (tr *SharedVPCServiceProject) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SharedVPCServiceProject +func (tr *SharedVPCServiceProject) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SharedVPCServiceProject using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SharedVPCServiceProject) LateInitialize(attrs []byte) (bool, error) { @@ -6395,6 +8646,36 @@ func (tr *Snapshot) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Snapshot using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { @@ -6479,6 +8760,36 @@ func (tr *SnapshotIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SnapshotIAMMember +func (tr *SnapshotIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SnapshotIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SnapshotIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -6563,6 +8874,36 @@ func (tr *SSLCertificate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SSLCertificate +func (tr *SSLCertificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SSLCertificate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SSLCertificate) LateInitialize(attrs []byte) (bool, error) { @@ -6647,6 +8988,36 @@ func (tr *SSLPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SSLPolicy +func (tr *SSLPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SSLPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SSLPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -6731,6 +9102,36 @@ func (tr *Subnetwork) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Subnetwork +func (tr *Subnetwork) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Subnetwork using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Subnetwork) LateInitialize(attrs []byte) (bool, error) { @@ -6815,6 +9216,36 @@ func (tr *SubnetworkIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SubnetworkIAMMember +func (tr *SubnetworkIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SubnetworkIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SubnetworkIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -6899,6 +9330,36 @@ func (tr *TargetGRPCProxy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TargetGRPCProxy +func (tr *TargetGRPCProxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TargetGRPCProxy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TargetGRPCProxy) LateInitialize(attrs []byte) (bool, error) { @@ -6983,6 +9444,36 @@ func (tr *TargetHTTPProxy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TargetHTTPProxy +func (tr *TargetHTTPProxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TargetHTTPProxy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TargetHTTPProxy) LateInitialize(attrs []byte) (bool, error) { @@ -7067,6 +9558,36 @@ func (tr *TargetHTTPSProxy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TargetHTTPSProxy +func (tr *TargetHTTPSProxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TargetHTTPSProxy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TargetHTTPSProxy) LateInitialize(attrs []byte) (bool, error) { @@ -7151,6 +9672,36 @@ func (tr *TargetInstance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TargetInstance +func (tr *TargetInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TargetInstance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TargetInstance) LateInitialize(attrs []byte) (bool, error) { @@ -7235,6 +9786,36 @@ func (tr *TargetPool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TargetPool +func (tr *TargetPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TargetPool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TargetPool) LateInitialize(attrs []byte) (bool, error) { @@ -7319,6 +9900,36 @@ func (tr *TargetSSLProxy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TargetSSLProxy +func (tr *TargetSSLProxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TargetSSLProxy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TargetSSLProxy) LateInitialize(attrs []byte) (bool, error) { @@ -7403,6 +10014,36 @@ func (tr *TargetTCPProxy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TargetTCPProxy +func (tr *TargetTCPProxy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TargetTCPProxy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TargetTCPProxy) LateInitialize(attrs []byte) (bool, error) { @@ -7487,6 +10128,36 @@ func (tr *URLMap) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this URLMap +func (tr *URLMap) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this URLMap using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *URLMap) LateInitialize(attrs []byte) (bool, error) { @@ -7571,6 +10242,36 @@ func (tr *VPNGateway) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this VPNGateway +func (tr *VPNGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this VPNGateway using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *VPNGateway) LateInitialize(attrs []byte) (bool, error) { @@ -7655,6 +10356,36 @@ func (tr *VPNTunnel) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this VPNTunnel +func (tr *VPNTunnel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this VPNTunnel using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *VPNTunnel) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/container/v1beta1/zz_generated_terraformed.go b/apis/container/v1beta1/zz_generated_terraformed.go index 7b5879bf3..92e2f02da 100755 --- a/apis/container/v1beta1/zz_generated_terraformed.go +++ b/apis/container/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Cluster) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Cluster using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { @@ -195,6 +226,36 @@ func (tr *NodePool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NodePool +func (tr *NodePool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NodePool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NodePool) LateInitialize(attrs []byte) (bool, error) { @@ -279,6 +340,36 @@ func (tr *Registry) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Registry +func (tr *Registry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Registry using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Registry) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/containeranalysis/v1beta1/zz_generated_terraformed.go b/apis/containeranalysis/v1beta1/zz_generated_terraformed.go index fe3a4b7b5..c3b4df206 100755 --- a/apis/containeranalysis/v1beta1/zz_generated_terraformed.go +++ b/apis/containeranalysis/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Note) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Note +func (tr *Note) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Note using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Note) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/containeraws/v1beta1/zz_generated_terraformed.go b/apis/containeraws/v1beta1/zz_generated_terraformed.go index b277259bd..131d62695 100755 --- a/apis/containeraws/v1beta1/zz_generated_terraformed.go +++ b/apis/containeraws/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Cluster) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Cluster using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *NodePool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NodePool +func (tr *NodePool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NodePool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NodePool) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/containerazure/v1beta1/zz_generated_terraformed.go b/apis/containerazure/v1beta1/zz_generated_terraformed.go index 00eab17b9..427275af5 100755 --- a/apis/containerazure/v1beta1/zz_generated_terraformed.go +++ b/apis/containerazure/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Client) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Client +func (tr *Client) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Client using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Client) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Cluster) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Cluster using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *NodePool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NodePool +func (tr *NodePool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NodePool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NodePool) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/datacatalog/v1beta1/zz_generated_terraformed.go b/apis/datacatalog/v1beta1/zz_generated_terraformed.go index a4c72e5ab..b77fa201b 100755 --- a/apis/datacatalog/v1beta1/zz_generated_terraformed.go +++ b/apis/datacatalog/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Entry) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Entry +func (tr *Entry) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Entry using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Entry) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *EntryGroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this EntryGroup +func (tr *EntryGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this EntryGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *EntryGroup) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Tag) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Tag +func (tr *Tag) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Tag using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Tag) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *TagTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TagTemplate +func (tr *TagTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TagTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TagTemplate) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/dataflow/v1beta1/zz_generated_terraformed.go b/apis/dataflow/v1beta1/zz_generated_terraformed.go index 78665cfe6..96edbf738 100755 --- a/apis/dataflow/v1beta1/zz_generated_terraformed.go +++ b/apis/dataflow/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Job) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Job +func (tr *Job) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Job using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Job) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/datafusion/v1beta1/zz_generated_terraformed.go b/apis/datafusion/v1beta1/zz_generated_terraformed.go index 9038e3d0d..f019b1423 100755 --- a/apis/datafusion/v1beta1/zz_generated_terraformed.go +++ b/apis/datafusion/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/datalossprevention/v1beta1/zz_generated_terraformed.go b/apis/datalossprevention/v1beta1/zz_generated_terraformed.go index eb7e0c85f..404bac992 100755 --- a/apis/datalossprevention/v1beta1/zz_generated_terraformed.go +++ b/apis/datalossprevention/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *DeidentifyTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DeidentifyTemplate +func (tr *DeidentifyTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DeidentifyTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DeidentifyTemplate) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *InspectTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InspectTemplate +func (tr *InspectTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InspectTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InspectTemplate) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *JobTrigger) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this JobTrigger +func (tr *JobTrigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this JobTrigger using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *JobTrigger) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *StoredInfoType) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this StoredInfoType +func (tr *StoredInfoType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this StoredInfoType using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *StoredInfoType) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/dataplex/v1beta1/zz_generated_terraformed.go b/apis/dataplex/v1beta1/zz_generated_terraformed.go index f13e9203c..3f2856668 100755 --- a/apis/dataplex/v1beta1/zz_generated_terraformed.go +++ b/apis/dataplex/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Asset) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Asset +func (tr *Asset) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Asset using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Asset) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Lake) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Lake +func (tr *Lake) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Lake using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Lake) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Zone) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Zone +func (tr *Zone) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Zone using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Zone) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/dataproc/v1beta1/zz_generated_terraformed.go b/apis/dataproc/v1beta1/zz_generated_terraformed.go index 2b8f7bcd6..07c2855c4 100755 --- a/apis/dataproc/v1beta1/zz_generated_terraformed.go +++ b/apis/dataproc/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AutoscalingPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AutoscalingPolicy +func (tr *AutoscalingPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AutoscalingPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AutoscalingPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Cluster) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Cluster +func (tr *Cluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Cluster using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Cluster) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Job) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Job +func (tr *Job) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Job using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Job) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *MetastoreService) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MetastoreService +func (tr *MetastoreService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MetastoreService using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MetastoreService) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *WorkflowTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WorkflowTemplate +func (tr *WorkflowTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WorkflowTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WorkflowTemplate) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/datastore/v1beta1/zz_generated_terraformed.go b/apis/datastore/v1beta1/zz_generated_terraformed.go index 1be70d416..6475b63ae 100755 --- a/apis/datastore/v1beta1/zz_generated_terraformed.go +++ b/apis/datastore/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Index) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Index +func (tr *Index) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Index using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Index) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/datastream/v1beta1/zz_generated_terraformed.go b/apis/datastream/v1beta1/zz_generated_terraformed.go index c85387e9d..2a67f3093 100755 --- a/apis/datastream/v1beta1/zz_generated_terraformed.go +++ b/apis/datastream/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *ConnectionProfile) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ConnectionProfile +func (tr *ConnectionProfile) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ConnectionProfile using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ConnectionProfile) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *PrivateConnection) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this PrivateConnection +func (tr *PrivateConnection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this PrivateConnection using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *PrivateConnection) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/dialogflowcx/v1beta1/zz_generated_terraformed.go b/apis/dialogflowcx/v1beta1/zz_generated_terraformed.go index 685c5e709..e6ed892e6 100755 --- a/apis/dialogflowcx/v1beta1/zz_generated_terraformed.go +++ b/apis/dialogflowcx/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Agent) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Agent +func (tr *Agent) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Agent using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Agent) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *EntityType) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this EntityType +func (tr *EntityType) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this EntityType using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *EntityType) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Environment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Environment +func (tr *Environment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Environment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Environment) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *Flow) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Flow +func (tr *Flow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Flow using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Flow) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *Intent) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Intent +func (tr *Intent) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Intent using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Intent) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *Page) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Page +func (tr *Page) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Page using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Page) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *Version) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Version +func (tr *Version) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Version using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Version) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *Webhook) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Webhook +func (tr *Webhook) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Webhook using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Webhook) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/dns/v1beta1/zz_generated_terraformed.go b/apis/dns/v1beta1/zz_generated_terraformed.go index f3809e593..7a8b26e3f 100755 --- a/apis/dns/v1beta1/zz_generated_terraformed.go +++ b/apis/dns/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *ManagedZone) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ManagedZone +func (tr *ManagedZone) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ManagedZone using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ManagedZone) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *ManagedZoneIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ManagedZoneIAMMember +func (tr *ManagedZoneIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ManagedZoneIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ManagedZoneIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Policy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Policy +func (tr *Policy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Policy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Policy) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *RecordSet) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RecordSet +func (tr *RecordSet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RecordSet using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RecordSet) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/documentai/v1beta1/zz_generated_terraformed.go b/apis/documentai/v1beta1/zz_generated_terraformed.go index 25c11ac01..8e6716567 100755 --- a/apis/documentai/v1beta1/zz_generated_terraformed.go +++ b/apis/documentai/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Processor) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Processor +func (tr *Processor) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Processor using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Processor) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/essentialcontacts/v1beta1/zz_generated_terraformed.go b/apis/essentialcontacts/v1beta1/zz_generated_terraformed.go index 9c1d6462b..09d85fee2 100755 --- a/apis/essentialcontacts/v1beta1/zz_generated_terraformed.go +++ b/apis/essentialcontacts/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Contact) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Contact +func (tr *Contact) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Contact using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Contact) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/eventarc/v1beta1/zz_generated_terraformed.go b/apis/eventarc/v1beta1/zz_generated_terraformed.go index 5bdc444af..3ab813658 100755 --- a/apis/eventarc/v1beta1/zz_generated_terraformed.go +++ b/apis/eventarc/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Channel) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Channel +func (tr *Channel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Channel using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Channel) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *GoogleChannelConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this GoogleChannelConfig +func (tr *GoogleChannelConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this GoogleChannelConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *GoogleChannelConfig) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Trigger) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Trigger +func (tr *Trigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Trigger using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Trigger) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/filestore/v1beta1/zz_generated_terraformed.go b/apis/filestore/v1beta1/zz_generated_terraformed.go index ca778eeda..7a9faca95 100755 --- a/apis/filestore/v1beta1/zz_generated_terraformed.go +++ b/apis/filestore/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Backup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Backup +func (tr *Backup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Backup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Backup) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Snapshot) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Snapshot +func (tr *Snapshot) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Snapshot using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Snapshot) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/firebaserules/v1beta1/zz_generated_terraformed.go b/apis/firebaserules/v1beta1/zz_generated_terraformed.go index 4d1153af3..68dcd428a 100755 --- a/apis/firebaserules/v1beta1/zz_generated_terraformed.go +++ b/apis/firebaserules/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Release) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Release +func (tr *Release) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Release using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Release) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Ruleset) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Ruleset +func (tr *Ruleset) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Ruleset using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Ruleset) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/gke/v1beta1/zz_generated_terraformed.go b/apis/gke/v1beta1/zz_generated_terraformed.go index 893f09acc..8f1095a94 100755 --- a/apis/gke/v1beta1/zz_generated_terraformed.go +++ b/apis/gke/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *BackupBackupPlan) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BackupBackupPlan +func (tr *BackupBackupPlan) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BackupBackupPlan using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BackupBackupPlan) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/gkehub/v1beta1/zz_generated_terraformed.go b/apis/gkehub/v1beta1/zz_generated_terraformed.go index b0ab84c1a..67cc6f034 100755 --- a/apis/gkehub/v1beta1/zz_generated_terraformed.go +++ b/apis/gkehub/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Membership) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Membership +func (tr *Membership) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Membership using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Membership) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *MembershipIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MembershipIAMMember +func (tr *MembershipIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MembershipIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MembershipIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/healthcare/v1beta1/zz_generated_terraformed.go b/apis/healthcare/v1beta1/zz_generated_terraformed.go index 796354eaa..fc2005292 100755 --- a/apis/healthcare/v1beta1/zz_generated_terraformed.go +++ b/apis/healthcare/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *ConsentStore) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ConsentStore +func (tr *ConsentStore) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ConsentStore using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ConsentStore) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Dataset) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Dataset +func (tr *Dataset) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Dataset using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Dataset) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *DatasetIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DatasetIAMMember +func (tr *DatasetIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DatasetIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DatasetIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/iam/v1beta1/zz_generated_terraformed.go b/apis/iam/v1beta1/zz_generated_terraformed.go index aa8ef7332..8f7bb37db 100755 --- a/apis/iam/v1beta1/zz_generated_terraformed.go +++ b/apis/iam/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *WorkloadIdentityPool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WorkloadIdentityPool +func (tr *WorkloadIdentityPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WorkloadIdentityPool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WorkloadIdentityPool) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *WorkloadIdentityPoolProvider) GetInitParameters() (map[string]any, err return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WorkloadIdentityPoolProvider +func (tr *WorkloadIdentityPoolProvider) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WorkloadIdentityPoolProvider using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WorkloadIdentityPoolProvider) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/iap/v1beta1/zz_generated_terraformed.go b/apis/iap/v1beta1/zz_generated_terraformed.go index 9099b7fd4..1f3ba063f 100755 --- a/apis/iap/v1beta1/zz_generated_terraformed.go +++ b/apis/iap/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AppEngineServiceIAMMember) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AppEngineServiceIAMMember +func (tr *AppEngineServiceIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AppEngineServiceIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AppEngineServiceIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *AppEngineVersionIAMMember) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AppEngineVersionIAMMember +func (tr *AppEngineVersionIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AppEngineVersionIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AppEngineVersionIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *TunnelIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TunnelIAMMember +func (tr *TunnelIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TunnelIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TunnelIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *WebBackendServiceIAMMember) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WebBackendServiceIAMMember +func (tr *WebBackendServiceIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WebBackendServiceIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WebBackendServiceIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *WebIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WebIAMMember +func (tr *WebIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WebIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WebIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *WebTypeAppEngineIAMMember) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WebTypeAppEngineIAMMember +func (tr *WebTypeAppEngineIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WebTypeAppEngineIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WebTypeAppEngineIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *WebTypeComputeIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this WebTypeComputeIAMMember +func (tr *WebTypeComputeIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this WebTypeComputeIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *WebTypeComputeIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/identityplatform/v1beta1/zz_generated_terraformed.go b/apis/identityplatform/v1beta1/zz_generated_terraformed.go index 63b321cdb..2ddbfe82e 100755 --- a/apis/identityplatform/v1beta1/zz_generated_terraformed.go +++ b/apis/identityplatform/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *DefaultSupportedIdPConfig) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DefaultSupportedIdPConfig +func (tr *DefaultSupportedIdPConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DefaultSupportedIdPConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DefaultSupportedIdPConfig) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *InboundSAMLConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InboundSAMLConfig +func (tr *InboundSAMLConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InboundSAMLConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InboundSAMLConfig) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *OAuthIdPConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this OAuthIdPConfig +func (tr *OAuthIdPConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this OAuthIdPConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *OAuthIdPConfig) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *ProjectDefaultConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectDefaultConfig +func (tr *ProjectDefaultConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectDefaultConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectDefaultConfig) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *Tenant) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Tenant +func (tr *Tenant) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Tenant using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Tenant) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *TenantDefaultSupportedIdPConfig) GetInitParameters() (map[string]any, return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TenantDefaultSupportedIdPConfig +func (tr *TenantDefaultSupportedIdPConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TenantDefaultSupportedIdPConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TenantDefaultSupportedIdPConfig) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *TenantInboundSAMLConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TenantInboundSAMLConfig +func (tr *TenantInboundSAMLConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TenantInboundSAMLConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TenantInboundSAMLConfig) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *TenantOAuthIdPConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TenantOAuthIdPConfig +func (tr *TenantOAuthIdPConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TenantOAuthIdPConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TenantOAuthIdPConfig) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/kms/v1beta1/zz_generated_terraformed.go b/apis/kms/v1beta1/zz_generated_terraformed.go index 1fa11b73f..73bc15679 100755 --- a/apis/kms/v1beta1/zz_generated_terraformed.go +++ b/apis/kms/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *CryptoKey) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CryptoKey +func (tr *CryptoKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CryptoKey using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CryptoKey) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *CryptoKeyIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CryptoKeyIAMMember +func (tr *CryptoKeyIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CryptoKeyIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CryptoKeyIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *CryptoKeyVersion) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CryptoKeyVersion +func (tr *CryptoKeyVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CryptoKeyVersion using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CryptoKeyVersion) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *KeyRing) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this KeyRing +func (tr *KeyRing) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this KeyRing using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *KeyRing) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *KeyRingIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this KeyRingIAMMember +func (tr *KeyRingIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this KeyRingIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *KeyRingIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *KeyRingImportJob) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this KeyRingImportJob +func (tr *KeyRingImportJob) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this KeyRingImportJob using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *KeyRingImportJob) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *SecretCiphertext) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SecretCiphertext +func (tr *SecretCiphertext) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SecretCiphertext using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SecretCiphertext) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/logging/v1beta1/zz_generated_terraformed.go b/apis/logging/v1beta1/zz_generated_terraformed.go index 358398a39..fd0dc3da3 100755 --- a/apis/logging/v1beta1/zz_generated_terraformed.go +++ b/apis/logging/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *LogView) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this LogView +func (tr *LogView) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this LogView using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *LogView) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Metric) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Metric +func (tr *Metric) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Metric using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Metric) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *ProjectBucketConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectBucketConfig +func (tr *ProjectBucketConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectBucketConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectBucketConfig) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *ProjectExclusion) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectExclusion +func (tr *ProjectExclusion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectExclusion using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectExclusion) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *ProjectSink) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProjectSink +func (tr *ProjectSink) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProjectSink using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProjectSink) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/memcache/v1beta1/zz_generated_terraformed.go b/apis/memcache/v1beta1/zz_generated_terraformed.go index cfde8f0b2..e774a3aef 100755 --- a/apis/memcache/v1beta1/zz_generated_terraformed.go +++ b/apis/memcache/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/mlengine/v1beta1/zz_generated_terraformed.go b/apis/mlengine/v1beta1/zz_generated_terraformed.go index d9afec5cc..7728c1954 100755 --- a/apis/mlengine/v1beta1/zz_generated_terraformed.go +++ b/apis/mlengine/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Model) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Model +func (tr *Model) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Model using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Model) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/monitoring/v1beta1/zz_generated_terraformed.go b/apis/monitoring/v1beta1/zz_generated_terraformed.go index e1902c44b..0e3a76970 100755 --- a/apis/monitoring/v1beta1/zz_generated_terraformed.go +++ b/apis/monitoring/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AlertPolicy) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AlertPolicy +func (tr *AlertPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AlertPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AlertPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *CustomService) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CustomService +func (tr *CustomService) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CustomService using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CustomService) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Dashboard) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Dashboard +func (tr *Dashboard) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Dashboard using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Dashboard) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *Group) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Group +func (tr *Group) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Group using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Group) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *MetricDescriptor) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MetricDescriptor +func (tr *MetricDescriptor) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MetricDescriptor using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MetricDescriptor) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *NotificationChannel) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this NotificationChannel +func (tr *NotificationChannel) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this NotificationChannel using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *NotificationChannel) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *Service) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Service +func (tr *Service) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Service using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Service) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *SLO) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SLO +func (tr *SLO) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SLO using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SLO) LateInitialize(attrs []byte) (bool, error) { @@ -767,6 +1008,36 @@ func (tr *UptimeCheckConfig) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this UptimeCheckConfig +func (tr *UptimeCheckConfig) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this UptimeCheckConfig using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *UptimeCheckConfig) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/networkconnectivity/v1beta1/zz_generated_terraformed.go b/apis/networkconnectivity/v1beta1/zz_generated_terraformed.go index d76c1ae0f..46c273721 100755 --- a/apis/networkconnectivity/v1beta1/zz_generated_terraformed.go +++ b/apis/networkconnectivity/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Hub) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Hub +func (tr *Hub) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Hub using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Hub) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Spoke) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Spoke +func (tr *Spoke) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Spoke using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Spoke) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/networkmanagement/v1beta1/zz_generated_terraformed.go b/apis/networkmanagement/v1beta1/zz_generated_terraformed.go index 7750906d1..ac1775743 100755 --- a/apis/networkmanagement/v1beta1/zz_generated_terraformed.go +++ b/apis/networkmanagement/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *ConnectivityTest) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ConnectivityTest +func (tr *ConnectivityTest) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ConnectivityTest using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ConnectivityTest) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/notebooks/v1beta1/zz_generated_terraformed.go b/apis/notebooks/v1beta1/zz_generated_terraformed.go index ab3b752f1..313284014 100755 --- a/apis/notebooks/v1beta1/zz_generated_terraformed.go +++ b/apis/notebooks/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Environment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Environment +func (tr *Environment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Environment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Environment) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *InstanceIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceIAMMember +func (tr *InstanceIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *Runtime) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Runtime +func (tr *Runtime) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Runtime using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Runtime) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *RuntimeIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RuntimeIAMMember +func (tr *RuntimeIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RuntimeIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RuntimeIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/osconfig/v1beta1/zz_generated_terraformed.go b/apis/osconfig/v1beta1/zz_generated_terraformed.go index c7216c115..911611001 100755 --- a/apis/osconfig/v1beta1/zz_generated_terraformed.go +++ b/apis/osconfig/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *OsPolicyAssignment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this OsPolicyAssignment +func (tr *OsPolicyAssignment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this OsPolicyAssignment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *OsPolicyAssignment) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *PatchDeployment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this PatchDeployment +func (tr *PatchDeployment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this PatchDeployment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *PatchDeployment) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/oslogin/v1beta1/zz_generated_terraformed.go b/apis/oslogin/v1beta1/zz_generated_terraformed.go index c0017fca9..fb2d1053e 100755 --- a/apis/oslogin/v1beta1/zz_generated_terraformed.go +++ b/apis/oslogin/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *SSHPublicKey) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SSHPublicKey +func (tr *SSHPublicKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SSHPublicKey using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SSHPublicKey) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/privateca/v1beta1/zz_generated_terraformed.go b/apis/privateca/v1beta1/zz_generated_terraformed.go index 187a9a960..616cdd8fb 100755 --- a/apis/privateca/v1beta1/zz_generated_terraformed.go +++ b/apis/privateca/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *CAPool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CAPool +func (tr *CAPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CAPool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CAPool) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *CAPoolIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CAPoolIAMMember +func (tr *CAPoolIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CAPoolIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CAPoolIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Certificate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Certificate +func (tr *Certificate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Certificate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Certificate) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *CertificateAuthority) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CertificateAuthority +func (tr *CertificateAuthority) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CertificateAuthority using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CertificateAuthority) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *CertificateTemplate) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CertificateTemplate +func (tr *CertificateTemplate) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CertificateTemplate using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CertificateTemplate) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *CertificateTemplateIAMMember) GetInitParameters() (map[string]any, err return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CertificateTemplateIAMMember +func (tr *CertificateTemplateIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CertificateTemplateIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CertificateTemplateIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/pubsub/v1beta1/zz_generated_terraformed.go b/apis/pubsub/v1beta1/zz_generated_terraformed.go index 02135fb6e..bbd28a43c 100755 --- a/apis/pubsub/v1beta1/zz_generated_terraformed.go +++ b/apis/pubsub/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *LiteReservation) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this LiteReservation +func (tr *LiteReservation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this LiteReservation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *LiteReservation) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *LiteSubscription) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this LiteSubscription +func (tr *LiteSubscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this LiteSubscription using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *LiteSubscription) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *LiteTopic) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this LiteTopic +func (tr *LiteTopic) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this LiteTopic using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *LiteTopic) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *Schema) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Schema +func (tr *Schema) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Schema using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Schema) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *Subscription) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Subscription +func (tr *Subscription) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Subscription using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Subscription) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *SubscriptionIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SubscriptionIAMMember +func (tr *SubscriptionIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SubscriptionIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SubscriptionIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *Topic) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Topic +func (tr *Topic) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Topic using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Topic) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *TopicIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this TopicIAMMember +func (tr *TopicIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this TopicIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *TopicIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/redis/v1beta1/zz_generated_terraformed.go b/apis/redis/v1beta1/zz_generated_terraformed.go index 564dd9d7e..b26dc3d44 100755 --- a/apis/redis/v1beta1/zz_generated_terraformed.go +++ b/apis/redis/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/secretmanager/v1beta1/zz_generated_terraformed.go b/apis/secretmanager/v1beta1/zz_generated_terraformed.go index e14c83dc8..f5eabfe22 100755 --- a/apis/secretmanager/v1beta1/zz_generated_terraformed.go +++ b/apis/secretmanager/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Secret) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Secret +func (tr *Secret) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Secret using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Secret) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *SecretIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SecretIAMMember +func (tr *SecretIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SecretIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SecretIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *SecretVersion) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SecretVersion +func (tr *SecretVersion) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SecretVersion using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SecretVersion) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/servicenetworking/v1beta1/zz_generated_terraformed.go b/apis/servicenetworking/v1beta1/zz_generated_terraformed.go index 47c5058c5..c0b9f1074 100755 --- a/apis/servicenetworking/v1beta1/zz_generated_terraformed.go +++ b/apis/servicenetworking/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Connection) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Connection +func (tr *Connection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Connection using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Connection) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/sourcerepo/v1beta1/zz_generated_terraformed.go b/apis/sourcerepo/v1beta1/zz_generated_terraformed.go index 910f6fc03..ac1e7e066 100755 --- a/apis/sourcerepo/v1beta1/zz_generated_terraformed.go +++ b/apis/sourcerepo/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Repository) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Repository +func (tr *Repository) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Repository using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Repository) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *RepositoryIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RepositoryIAMMember +func (tr *RepositoryIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RepositoryIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RepositoryIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/spanner/v1beta1/zz_generated_terraformed.go b/apis/spanner/v1beta1/zz_generated_terraformed.go index 476504d5f..7f26a030c 100755 --- a/apis/spanner/v1beta1/zz_generated_terraformed.go +++ b/apis/spanner/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Database) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Database +func (tr *Database) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Database using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Database) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *DatabaseIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DatabaseIAMMember +func (tr *DatabaseIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DatabaseIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DatabaseIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *Instance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Instance +func (tr *Instance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Instance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Instance) LateInitialize(attrs []byte) (bool, error) { @@ -349,6 +440,36 @@ func (tr *InstanceIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this InstanceIAMMember +func (tr *InstanceIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this InstanceIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *InstanceIAMMember) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/sql/v1beta1/zz_generated_terraformed.go b/apis/sql/v1beta1/zz_generated_terraformed.go index f33820e25..20bc431dd 100755 --- a/apis/sql/v1beta1/zz_generated_terraformed.go +++ b/apis/sql/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Database) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Database +func (tr *Database) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Database using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Database) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *DatabaseInstance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DatabaseInstance +func (tr *DatabaseInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DatabaseInstance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DatabaseInstance) LateInitialize(attrs []byte) (bool, error) { @@ -264,6 +325,36 @@ func (tr *SourceRepresentationInstance) GetInitParameters() (map[string]any, err return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SourceRepresentationInstance +func (tr *SourceRepresentationInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SourceRepresentationInstance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SourceRepresentationInstance) LateInitialize(attrs []byte) (bool, error) { @@ -348,6 +439,36 @@ func (tr *SSLCert) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SSLCert +func (tr *SSLCert) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SSLCert using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SSLCert) LateInitialize(attrs []byte) (bool, error) { @@ -432,6 +553,36 @@ func (tr *User) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this User +func (tr *User) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this User using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *User) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/storage/v1beta1/zz_generated_terraformed.go b/apis/storage/v1beta1/zz_generated_terraformed.go index 745ffa694..3cc763788 100755 --- a/apis/storage/v1beta1/zz_generated_terraformed.go +++ b/apis/storage/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Bucket) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Bucket +func (tr *Bucket) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Bucket using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Bucket) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *BucketAccessControl) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BucketAccessControl +func (tr *BucketAccessControl) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BucketAccessControl using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BucketAccessControl) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *BucketACL) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BucketACL +func (tr *BucketACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BucketACL using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BucketACL) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *BucketIAMMember) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BucketIAMMember +func (tr *BucketIAMMember) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BucketIAMMember using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BucketIAMMember) LateInitialize(attrs []byte) (bool, error) { @@ -431,6 +552,36 @@ func (tr *BucketObject) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this BucketObject +func (tr *BucketObject) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this BucketObject using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *BucketObject) LateInitialize(attrs []byte) (bool, error) { @@ -515,6 +666,36 @@ func (tr *DefaultObjectAccessControl) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DefaultObjectAccessControl +func (tr *DefaultObjectAccessControl) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DefaultObjectAccessControl using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DefaultObjectAccessControl) LateInitialize(attrs []byte) (bool, error) { @@ -599,6 +780,36 @@ func (tr *DefaultObjectACL) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this DefaultObjectACL +func (tr *DefaultObjectACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this DefaultObjectACL using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *DefaultObjectACL) LateInitialize(attrs []byte) (bool, error) { @@ -683,6 +894,36 @@ func (tr *Notification) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Notification +func (tr *Notification) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Notification using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Notification) LateInitialize(attrs []byte) (bool, error) { @@ -767,6 +1008,36 @@ func (tr *ObjectAccessControl) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ObjectAccessControl +func (tr *ObjectAccessControl) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ObjectAccessControl using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ObjectAccessControl) LateInitialize(attrs []byte) (bool, error) { @@ -851,6 +1122,36 @@ func (tr *ObjectACL) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ObjectACL +func (tr *ObjectACL) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ObjectACL using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ObjectACL) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/storagetransfer/v1beta1/zz_generated_terraformed.go b/apis/storagetransfer/v1beta1/zz_generated_terraformed.go index 72f6c9001..00ae566c7 100755 --- a/apis/storagetransfer/v1beta1/zz_generated_terraformed.go +++ b/apis/storagetransfer/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *AgentPool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this AgentPool +func (tr *AgentPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this AgentPool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *AgentPool) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/tpu/v1beta1/zz_generated_terraformed.go b/apis/tpu/v1beta1/zz_generated_terraformed.go index e91b7a083..d15c7c2af 100755 --- a/apis/tpu/v1beta1/zz_generated_terraformed.go +++ b/apis/tpu/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Node) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Node +func (tr *Node) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Node using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Node) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/vertexai/v1beta1/zz_generated_terraformed.go b/apis/vertexai/v1beta1/zz_generated_terraformed.go index 76bc47fe0..f0d84243b 100755 --- a/apis/vertexai/v1beta1/zz_generated_terraformed.go +++ b/apis/vertexai/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Dataset) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Dataset +func (tr *Dataset) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Dataset using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Dataset) LateInitialize(attrs []byte) (bool, error) { @@ -179,6 +210,36 @@ func (tr *Featurestore) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Featurestore +func (tr *Featurestore) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Featurestore using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Featurestore) LateInitialize(attrs []byte) (bool, error) { @@ -263,6 +324,36 @@ func (tr *FeaturestoreEntitytype) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FeaturestoreEntitytype +func (tr *FeaturestoreEntitytype) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FeaturestoreEntitytype using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FeaturestoreEntitytype) LateInitialize(attrs []byte) (bool, error) { @@ -347,6 +438,36 @@ func (tr *Tensorboard) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Tensorboard +func (tr *Tensorboard) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Tensorboard using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Tensorboard) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/vpcaccess/v1beta1/zz_generated_terraformed.go b/apis/vpcaccess/v1beta1/zz_generated_terraformed.go index 807807cca..c778d6dce 100755 --- a/apis/vpcaccess/v1beta1/zz_generated_terraformed.go +++ b/apis/vpcaccess/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Connector) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Connector +func (tr *Connector) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Connector using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Connector) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/workflows/v1beta1/zz_generated_terraformed.go b/apis/workflows/v1beta1/zz_generated_terraformed.go index 1ba949b6f..db702be58 100755 --- a/apis/workflows/v1beta1/zz_generated_terraformed.go +++ b/apis/workflows/v1beta1/zz_generated_terraformed.go @@ -23,6 +23,7 @@ limitations under the License. package v1beta1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -95,6 +96,36 @@ func (tr *Workflow) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Workflow +func (tr *Workflow) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Workflow using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Workflow) LateInitialize(attrs []byte) (bool, error) { diff --git a/cmd/generator/main.go b/cmd/generator/main.go index 45fb45fa6..5771e0d00 100644 --- a/cmd/generator/main.go +++ b/cmd/generator/main.go @@ -15,6 +15,7 @@ package main import ( + "context" "encoding/json" "fmt" "os" @@ -42,7 +43,8 @@ func main() { if err != nil { panic(fmt.Sprintf("cannot calculate the absolute path with %s", *repoRoot)) } - p := config.GetProvider() + p, err := config.GetProvider(context.Background(), true) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") dumpGeneratedResourceList(p, generatedResourceList) dumpSkippedResourcesCSV(p, skippedResourcesCSV) pipeline.Run(p, absRootDir) diff --git a/cmd/provider/accesscontextmanager/zz_main.go b/cmd/provider/accesscontextmanager/zz_main.go index 1b6ce8e72..4665be8ca 100644 --- a/cmd/provider/accesscontextmanager/zz_main.go +++ b/cmd/provider/accesscontextmanager/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/activedirectory/zz_main.go b/cmd/provider/activedirectory/zz_main.go index b5ffbbf30..6b39caadb 100644 --- a/cmd/provider/activedirectory/zz_main.go +++ b/cmd/provider/activedirectory/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/alloydb/zz_main.go b/cmd/provider/alloydb/zz_main.go index a3d106d03..ad5a410f0 100644 --- a/cmd/provider/alloydb/zz_main.go +++ b/cmd/provider/alloydb/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/apigee/zz_main.go b/cmd/provider/apigee/zz_main.go index 4f20d0654..847a8b647 100644 --- a/cmd/provider/apigee/zz_main.go +++ b/cmd/provider/apigee/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/appengine/zz_main.go b/cmd/provider/appengine/zz_main.go index 0e1a2d731..63dd888a7 100644 --- a/cmd/provider/appengine/zz_main.go +++ b/cmd/provider/appengine/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/artifact/zz_main.go b/cmd/provider/artifact/zz_main.go index 5f999df3c..8c5a2e286 100644 --- a/cmd/provider/artifact/zz_main.go +++ b/cmd/provider/artifact/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/beyondcorp/zz_main.go b/cmd/provider/beyondcorp/zz_main.go index d4bdd9447..d8336db70 100644 --- a/cmd/provider/beyondcorp/zz_main.go +++ b/cmd/provider/beyondcorp/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/bigquery/zz_main.go b/cmd/provider/bigquery/zz_main.go index 8a2203d81..dae2db032 100644 --- a/cmd/provider/bigquery/zz_main.go +++ b/cmd/provider/bigquery/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/bigtable/zz_main.go b/cmd/provider/bigtable/zz_main.go index b7eaf2307..351140196 100644 --- a/cmd/provider/bigtable/zz_main.go +++ b/cmd/provider/bigtable/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/binaryauthorization/zz_main.go b/cmd/provider/binaryauthorization/zz_main.go index e4ecd3b5d..3b129c89d 100644 --- a/cmd/provider/binaryauthorization/zz_main.go +++ b/cmd/provider/binaryauthorization/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/certificatemanager/zz_main.go b/cmd/provider/certificatemanager/zz_main.go index 737d5d701..4b62f8aa0 100644 --- a/cmd/provider/certificatemanager/zz_main.go +++ b/cmd/provider/certificatemanager/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloud/zz_main.go b/cmd/provider/cloud/zz_main.go index ba55aef7a..376bcf47d 100644 --- a/cmd/provider/cloud/zz_main.go +++ b/cmd/provider/cloud/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudbuild/zz_main.go b/cmd/provider/cloudbuild/zz_main.go index c14c3accf..0924877cc 100644 --- a/cmd/provider/cloudbuild/zz_main.go +++ b/cmd/provider/cloudbuild/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudfunctions/zz_main.go b/cmd/provider/cloudfunctions/zz_main.go index be3f83618..059c3ec59 100644 --- a/cmd/provider/cloudfunctions/zz_main.go +++ b/cmd/provider/cloudfunctions/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudfunctions2/zz_main.go b/cmd/provider/cloudfunctions2/zz_main.go index 8c6bdbead..8b790b8ef 100644 --- a/cmd/provider/cloudfunctions2/zz_main.go +++ b/cmd/provider/cloudfunctions2/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudiot/zz_main.go b/cmd/provider/cloudiot/zz_main.go index 4356ee0c8..62f361d71 100644 --- a/cmd/provider/cloudiot/zz_main.go +++ b/cmd/provider/cloudiot/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudplatform/zz_main.go b/cmd/provider/cloudplatform/zz_main.go index ad50e83d2..408a16fc7 100644 --- a/cmd/provider/cloudplatform/zz_main.go +++ b/cmd/provider/cloudplatform/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudrun/zz_main.go b/cmd/provider/cloudrun/zz_main.go index ace518561..340caafbe 100644 --- a/cmd/provider/cloudrun/zz_main.go +++ b/cmd/provider/cloudrun/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudscheduler/zz_main.go b/cmd/provider/cloudscheduler/zz_main.go index 7d82c6d29..074b6f28e 100644 --- a/cmd/provider/cloudscheduler/zz_main.go +++ b/cmd/provider/cloudscheduler/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/cloudtasks/zz_main.go b/cmd/provider/cloudtasks/zz_main.go index 808168435..16502494f 100644 --- a/cmd/provider/cloudtasks/zz_main.go +++ b/cmd/provider/cloudtasks/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/composer/zz_main.go b/cmd/provider/composer/zz_main.go index 3777dd71f..23d9deea1 100644 --- a/cmd/provider/composer/zz_main.go +++ b/cmd/provider/composer/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/compute/zz_main.go b/cmd/provider/compute/zz_main.go index 5e3935230..4e724cef0 100644 --- a/cmd/provider/compute/zz_main.go +++ b/cmd/provider/compute/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/config/zz_main.go b/cmd/provider/config/zz_main.go index 629a2851a..9f8480d67 100644 --- a/cmd/provider/config/zz_main.go +++ b/cmd/provider/config/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/container/zz_main.go b/cmd/provider/container/zz_main.go index d16bdc946..61cc8b3c4 100644 --- a/cmd/provider/container/zz_main.go +++ b/cmd/provider/container/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/containeranalysis/zz_main.go b/cmd/provider/containeranalysis/zz_main.go index 75eb949ea..43701e906 100644 --- a/cmd/provider/containeranalysis/zz_main.go +++ b/cmd/provider/containeranalysis/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/containeraws/zz_main.go b/cmd/provider/containeraws/zz_main.go index f436b6598..78d5948e7 100644 --- a/cmd/provider/containeraws/zz_main.go +++ b/cmd/provider/containeraws/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/containerazure/zz_main.go b/cmd/provider/containerazure/zz_main.go index 990fb7bf8..870a0d2d4 100644 --- a/cmd/provider/containerazure/zz_main.go +++ b/cmd/provider/containerazure/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/datacatalog/zz_main.go b/cmd/provider/datacatalog/zz_main.go index 695222e9b..4fdd51613 100644 --- a/cmd/provider/datacatalog/zz_main.go +++ b/cmd/provider/datacatalog/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/dataflow/zz_main.go b/cmd/provider/dataflow/zz_main.go index 4cdadeb30..76b758fe8 100644 --- a/cmd/provider/dataflow/zz_main.go +++ b/cmd/provider/dataflow/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/datafusion/zz_main.go b/cmd/provider/datafusion/zz_main.go index 19d43a9c1..a1f6e6ec9 100644 --- a/cmd/provider/datafusion/zz_main.go +++ b/cmd/provider/datafusion/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/datalossprevention/zz_main.go b/cmd/provider/datalossprevention/zz_main.go index aeb99da8a..4693313ff 100644 --- a/cmd/provider/datalossprevention/zz_main.go +++ b/cmd/provider/datalossprevention/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/dataplex/zz_main.go b/cmd/provider/dataplex/zz_main.go index c65c00e3e..37c185211 100644 --- a/cmd/provider/dataplex/zz_main.go +++ b/cmd/provider/dataplex/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/dataproc/zz_main.go b/cmd/provider/dataproc/zz_main.go index 913dd502b..41d212b8a 100644 --- a/cmd/provider/dataproc/zz_main.go +++ b/cmd/provider/dataproc/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/datastore/zz_main.go b/cmd/provider/datastore/zz_main.go index 2a298d792..cba31054a 100644 --- a/cmd/provider/datastore/zz_main.go +++ b/cmd/provider/datastore/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/datastream/zz_main.go b/cmd/provider/datastream/zz_main.go index 4a3235e83..421b3c399 100644 --- a/cmd/provider/datastream/zz_main.go +++ b/cmd/provider/datastream/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/dialogflowcx/zz_main.go b/cmd/provider/dialogflowcx/zz_main.go index 435535ed5..b71e83cec 100644 --- a/cmd/provider/dialogflowcx/zz_main.go +++ b/cmd/provider/dialogflowcx/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/dns/zz_main.go b/cmd/provider/dns/zz_main.go index 6228a363a..b0b86d612 100644 --- a/cmd/provider/dns/zz_main.go +++ b/cmd/provider/dns/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/documentai/zz_main.go b/cmd/provider/documentai/zz_main.go index ac73c1604..530a33fde 100644 --- a/cmd/provider/documentai/zz_main.go +++ b/cmd/provider/documentai/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/essentialcontacts/zz_main.go b/cmd/provider/essentialcontacts/zz_main.go index 918a0d941..a89fbd161 100644 --- a/cmd/provider/essentialcontacts/zz_main.go +++ b/cmd/provider/essentialcontacts/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/eventarc/zz_main.go b/cmd/provider/eventarc/zz_main.go index 0ca17ac39..243857301 100644 --- a/cmd/provider/eventarc/zz_main.go +++ b/cmd/provider/eventarc/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/filestore/zz_main.go b/cmd/provider/filestore/zz_main.go index 8eebe2301..1d36ae871 100644 --- a/cmd/provider/filestore/zz_main.go +++ b/cmd/provider/filestore/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/firebaserules/zz_main.go b/cmd/provider/firebaserules/zz_main.go index 79c4c5606..c683a87c4 100644 --- a/cmd/provider/firebaserules/zz_main.go +++ b/cmd/provider/firebaserules/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/gke/zz_main.go b/cmd/provider/gke/zz_main.go index 58835fd59..61690a8ec 100644 --- a/cmd/provider/gke/zz_main.go +++ b/cmd/provider/gke/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/gkehub/zz_main.go b/cmd/provider/gkehub/zz_main.go index c8e9d3826..234bc9834 100644 --- a/cmd/provider/gkehub/zz_main.go +++ b/cmd/provider/gkehub/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/healthcare/zz_main.go b/cmd/provider/healthcare/zz_main.go index e74eb039d..b0d379129 100644 --- a/cmd/provider/healthcare/zz_main.go +++ b/cmd/provider/healthcare/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/iam/zz_main.go b/cmd/provider/iam/zz_main.go index 3c90fe65a..1f46edffc 100644 --- a/cmd/provider/iam/zz_main.go +++ b/cmd/provider/iam/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/iap/zz_main.go b/cmd/provider/iap/zz_main.go index f6369f38b..3e9bbab3b 100644 --- a/cmd/provider/iap/zz_main.go +++ b/cmd/provider/iap/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/identityplatform/zz_main.go b/cmd/provider/identityplatform/zz_main.go index 7fe0c83a9..20381aa1a 100644 --- a/cmd/provider/identityplatform/zz_main.go +++ b/cmd/provider/identityplatform/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/kms/zz_main.go b/cmd/provider/kms/zz_main.go index b5482180f..10955f6ee 100644 --- a/cmd/provider/kms/zz_main.go +++ b/cmd/provider/kms/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/logging/zz_main.go b/cmd/provider/logging/zz_main.go index 0160803c8..e400c389b 100644 --- a/cmd/provider/logging/zz_main.go +++ b/cmd/provider/logging/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/memcache/zz_main.go b/cmd/provider/memcache/zz_main.go index 8694c5d45..ff6b13aa4 100644 --- a/cmd/provider/memcache/zz_main.go +++ b/cmd/provider/memcache/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/mlengine/zz_main.go b/cmd/provider/mlengine/zz_main.go index 39b05600b..0b2742b6b 100644 --- a/cmd/provider/mlengine/zz_main.go +++ b/cmd/provider/mlengine/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/monitoring/zz_main.go b/cmd/provider/monitoring/zz_main.go index c1fa2d9ef..08edec37c 100644 --- a/cmd/provider/monitoring/zz_main.go +++ b/cmd/provider/monitoring/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/monolith/zz_main.go b/cmd/provider/monolith/zz_main.go index 7ed804fc3..692b76e18 100644 --- a/cmd/provider/monolith/zz_main.go +++ b/cmd/provider/monolith/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/networkconnectivity/zz_main.go b/cmd/provider/networkconnectivity/zz_main.go index a4202ce66..e3cd9de14 100644 --- a/cmd/provider/networkconnectivity/zz_main.go +++ b/cmd/provider/networkconnectivity/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/networkmanagement/zz_main.go b/cmd/provider/networkmanagement/zz_main.go index c86e81a89..fe87da1ba 100644 --- a/cmd/provider/networkmanagement/zz_main.go +++ b/cmd/provider/networkmanagement/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/notebooks/zz_main.go b/cmd/provider/notebooks/zz_main.go index 95962a43d..b1fa9b073 100644 --- a/cmd/provider/notebooks/zz_main.go +++ b/cmd/provider/notebooks/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/osconfig/zz_main.go b/cmd/provider/osconfig/zz_main.go index b88573cf9..eca972259 100644 --- a/cmd/provider/osconfig/zz_main.go +++ b/cmd/provider/osconfig/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/oslogin/zz_main.go b/cmd/provider/oslogin/zz_main.go index 23269edbc..7121fdf6e 100644 --- a/cmd/provider/oslogin/zz_main.go +++ b/cmd/provider/oslogin/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/privateca/zz_main.go b/cmd/provider/privateca/zz_main.go index 3b1b89932..f40417d5a 100644 --- a/cmd/provider/privateca/zz_main.go +++ b/cmd/provider/privateca/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/pubsub/zz_main.go b/cmd/provider/pubsub/zz_main.go index 50b567d52..8806da9c6 100644 --- a/cmd/provider/pubsub/zz_main.go +++ b/cmd/provider/pubsub/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/redis/zz_main.go b/cmd/provider/redis/zz_main.go index 6bb85bec0..5cd91fb1d 100644 --- a/cmd/provider/redis/zz_main.go +++ b/cmd/provider/redis/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/secretmanager/zz_main.go b/cmd/provider/secretmanager/zz_main.go index fe8153163..11ad9e7b7 100644 --- a/cmd/provider/secretmanager/zz_main.go +++ b/cmd/provider/secretmanager/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/servicenetworking/zz_main.go b/cmd/provider/servicenetworking/zz_main.go index a50712250..0a42a09e7 100644 --- a/cmd/provider/servicenetworking/zz_main.go +++ b/cmd/provider/servicenetworking/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/sourcerepo/zz_main.go b/cmd/provider/sourcerepo/zz_main.go index fc4b61926..405632790 100644 --- a/cmd/provider/sourcerepo/zz_main.go +++ b/cmd/provider/sourcerepo/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/spanner/zz_main.go b/cmd/provider/spanner/zz_main.go index ccbdaaa7a..67db4b3b8 100644 --- a/cmd/provider/spanner/zz_main.go +++ b/cmd/provider/spanner/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/sql/zz_main.go b/cmd/provider/sql/zz_main.go index 22be2c201..03bf426e8 100644 --- a/cmd/provider/sql/zz_main.go +++ b/cmd/provider/sql/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/storage/zz_main.go b/cmd/provider/storage/zz_main.go index cca138962..acc46fe75 100644 --- a/cmd/provider/storage/zz_main.go +++ b/cmd/provider/storage/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/storagetransfer/zz_main.go b/cmd/provider/storagetransfer/zz_main.go index 0b3c3e7b7..2a7aa1d6f 100644 --- a/cmd/provider/storagetransfer/zz_main.go +++ b/cmd/provider/storagetransfer/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/tpu/zz_main.go b/cmd/provider/tpu/zz_main.go index fd1a5fbcb..fb8f0705e 100644 --- a/cmd/provider/tpu/zz_main.go +++ b/cmd/provider/tpu/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/vertexai/zz_main.go b/cmd/provider/vertexai/zz_main.go index 962202c2c..688222c44 100644 --- a/cmd/provider/vertexai/zz_main.go +++ b/cmd/provider/vertexai/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/vpcaccess/zz_main.go b/cmd/provider/vpcaccess/zz_main.go index c522f9a9a..dc2a0c658 100644 --- a/cmd/provider/vpcaccess/zz_main.go +++ b/cmd/provider/vpcaccess/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/cmd/provider/workflows/zz_main.go b/cmd/provider/workflows/zz_main.go index 383a6aed6..b26d8228c 100644 --- a/cmd/provider/workflows/zz_main.go +++ b/cmd/provider/workflows/zz_main.go @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/config/common/config.go b/config/common/config.go index 9c7dc778a..69d4ff16e 100644 --- a/config/common/config.go +++ b/config/common/config.go @@ -21,6 +21,9 @@ const ( // ExtractResourceIDFuncPath holds the GCP resource ID extractor func name ExtractResourceIDFuncPath = "github.com/upbound/provider-gcp/config/common.ExtractResourceID()" ExtractProjectIDFuncPath = "github.com/upbound/provider-gcp/config/common.ExtractProjectID()" + // VersionV1Beta1 is used for resources that meet the v1beta1 criteria + // here: https://github.com/upbound/arch/pull/33 + VersionV1Beta1 = "v1beta1" ) var ( diff --git a/config/externalname.go b/config/externalname.go index e2c1a1204..871db410c 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -6,9 +6,14 @@ package config import ( "github.com/crossplane/upjet/pkg/config" + + "github.com/upbound/provider-gcp/config/common" ) -var externalNameConfigs = map[string]config.ExternalName{ +// noForkExternalNameConfigs contains all external name configurations +// belonging to Terraform resources to be reconciled under the no-fork +// architecture for this provider. +var noForkExternalNameConfigs = map[string]config.ExternalName{ // activedirectory // // Imported by using the following format: {{name}} @@ -979,6 +984,11 @@ var externalNameConfigs = map[string]config.ExternalName{ "google_certificate_manager_certificate_map_entry": config.TemplatedStringAsIdentifier("name", "projects/{{ .setup.configuration.project }}/locations/global/certificateMaps/{{ .parameters.map }}/certificateMapEntries/{{ .external_name }}"), } +// cliReconciledExternalNameConfigs contains all external name configurations +// belonging to Terraform resources to be reconciled under the CLI-based +// architecture for this provider. +var cliReconciledExternalNameConfigs = map[string]config.ExternalName{} + // TemplatedStringAsIdentifierWithNoName uses TemplatedStringAsIdentifier but // without the name initializer. This allows it to be used in cases where the ID // is constructed with parameters and a provider-defined value, meaning no @@ -990,11 +1000,24 @@ func TemplatedStringAsIdentifierWithNoName(tmpl string) config.ExternalName { return e } -func externalNameConfigurations() config.ResourceOption { +// resourceConfigurator applies all external name configs +// listed in the table NoForkExternalNameConfigs and +// cliReconciledExternalNameConfigs and sets the version +// of those resources to v1beta1. For those resource in +// noForkExternalNameConfigs, it also sets +// config.Resource.UseNoForkClient to `true`. +func resourceConfigurator() config.ResourceOption { return func(r *config.Resource) { - if e, ok := externalNameConfigs[r.Name]; ok { - r.Version = VersionV1Beta1 - r.ExternalName = e + // if configured both for the no-fork and CLI based architectures, + // no-fork configuration prevails + e, configured := noForkExternalNameConfigs[r.Name] + if !configured { + e, configured = cliReconciledExternalNameConfigs[r.Name] + } + if !configured { + return } + r.Version = common.VersionV1Beta1 + r.ExternalName = e } } diff --git a/config/provider.go b/config/provider.go index bfe8e8703..ba269f0b5 100644 --- a/config/provider.go +++ b/config/provider.go @@ -15,12 +15,18 @@ package config import ( + "context" // Note(ezgidemirel): we are importing this to embed provider schema document _ "embed" tjconfig "github.com/crossplane/upjet/pkg/config" "github.com/crossplane/upjet/pkg/registry/reference" + conversiontfjson "github.com/crossplane/upjet/pkg/types/conversion/tfjson" "github.com/crossplane/upjet/pkg/types/name" + tfjson "github.com/hashicorp/terraform-json" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-google/google/provider" + "github.com/pkg/errors" "github.com/upbound/provider-gcp/config/accessapproval" "github.com/upbound/provider-gcp/config/accesscontextmanager" @@ -136,24 +142,59 @@ var skipList = []string{ "google_endpoints_service_consumers_iam_binding", } +// workaround for the TF Google v4.77.0-based no-fork release: We would like to +// keep the types in the generated CRDs intact +// (prevent number->int type replacements). +func getProviderSchema(s string) (*schema.Provider, error) { + ps := tfjson.ProviderSchemas{} + if err := ps.UnmarshalJSON([]byte(s)); err != nil { + panic(err) + } + if len(ps.Schemas) != 1 { + return nil, errors.Errorf("there should exactly be 1 provider schema but there are %d", len(ps.Schemas)) + } + var rs map[string]*tfjson.Schema + for _, v := range ps.Schemas { + rs = v.ResourceSchemas + break + } + return &schema.Provider{ + ResourcesMap: conversiontfjson.GetV2ResourceMap(rs), + }, nil +} + // GetProvider returns provider configuration -func GetProvider() *tjconfig.Provider { +func GetProvider(_ context.Context, generationProvider bool) (*tjconfig.Provider, error) { + var p *schema.Provider + var err error + if generationProvider { + p, err = getProviderSchema(providerSchema) + } else { + p = provider.Provider() + } + if err != nil { + return nil, errors.Wrapf(err, "cannot get the Terraform provider schema with generation mode set to %t", generationProvider) + } + pc := tjconfig.NewProvider([]byte(providerSchema), resourcePrefix, modulePath, providerMetadata, tjconfig.WithDefaultResourceOptions( groupOverrides(), externalNameConfig(), defaultVersion(), - externalNameConfigurations(), + resourceConfigurator(), descriptionOverrides(), ), tjconfig.WithRootGroup("gcp.upbound.io"), tjconfig.WithShortName("gcp"), // Comment out the following line to generate all resources. - tjconfig.WithIncludeList(resourcesWithExternalNameConfig()), + tjconfig.WithIncludeList(resourceList(cliReconciledExternalNameConfigs)), + tjconfig.WithNoForkIncludeList(resourceList(noForkExternalNameConfigs)), tjconfig.WithReferenceInjectors([]tjconfig.ReferenceInjector{reference.NewInjector(modulePath)}), tjconfig.WithSkipList(skipList), tjconfig.WithFeaturesPackage("internal/features"), - tjconfig.WithMainTemplate(hack.MainTemplate)) + tjconfig.WithMainTemplate(hack.MainTemplate), + tjconfig.WithTerraformProvider(p), + ) for _, configure := range []func(provider *tjconfig.Provider){ accessapproval.Configure, @@ -205,15 +246,15 @@ func GetProvider() *tjconfig.Provider { } pc.ConfigureResources() - return pc + return pc, nil } -// resourcesWithExternalNameConfig returns the list of resources that have external -// name configured in ExternalNameConfigs table. -func resourcesWithExternalNameConfig() []string { - l := make([]string, len(externalNameConfigs)) +// resourceList returns the list of resources that have external +// name configured in the specified table. +func resourceList(t map[string]tjconfig.ExternalName) []string { + l := make([]string, len(t)) i := 0 - for n := range externalNameConfigs { + for n := range t { // Expected format is regex and we'd like to have exact matches. l[i] = n + "$" i++ diff --git a/go.mod b/go.mod index 105057e1d..c63a2fefb 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,13 @@ module github.com/upbound/provider-gcp go 1.19 require ( + dario.cat/mergo v1.0.0 github.com/crossplane/crossplane-runtime v1.14.1 github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 - github.com/crossplane/upjet v0.11.0-rc.0.0.20231012093706-c4a76d2a7505 + github.com/crossplane/upjet v1.0.0 + github.com/hashicorp/terraform-json v0.14.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 + github.com/hashicorp/terraform-provider-google v1.20.1-0.20230807163356-c1a5133299b4 github.com/pkg/errors v0.9.1 gopkg.in/alecthomas/kingpin.v2 v2.2.6 k8s.io/apimachinery v0.28.4 @@ -16,22 +19,38 @@ require ( ) require ( - dario.cat/mergo v1.0.0 // indirect + bitbucket.org/creachadair/stringset v0.0.8 // indirect + cloud.google.com/go v0.110.7 // indirect + cloud.google.com/go/bigtable v1.19.0 // indirect + cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v1.1.1 // indirect + cloud.google.com/go/longrunning v0.5.1 // indirect + github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/antchfx/htmlquery v1.2.4 // indirect github.com/antchfx/xpath v1.2.0 // indirect + github.com/apparentlymart/go-cidr v1.1.0 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/cenkalti/backoff v2.2.1+incompatible // indirect + github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect + github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect github.com/dave/jennifer v1.4.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect + github.com/envoyproxy/go-control-plane v0.11.1 // indirect + github.com/envoyproxy/protoc-gen-validate v1.0.2 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fatih/camelcase v1.0.0 // indirect github.com/fatih/color v1.15.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 // indirect + github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92 // indirect github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/zapr v1.2.4 // indirect github.com/go-openapi/jsonpointer v0.19.6 // indirect @@ -39,69 +58,97 @@ require ( github.com/go-openapi/swag v0.22.3 // indirect github.com/gobuffalo/flect v1.0.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v1.1.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-cmp v0.6.0 // indirect + github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/google/s2a-go v0.1.4 // indirect github.com/google/uuid v1.3.1 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect + github.com/googleapis/gax-go/v2 v2.12.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-checkpoint v0.5.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect github.com/hashicorp/go-hclog v1.2.1 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.4.8 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/hc-install v0.4.0 // indirect github.com/hashicorp/hcl/v2 v2.14.1 // indirect github.com/hashicorp/logutils v1.0.0 // indirect - github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-go v0.14.0 // indirect + github.com/hashicorp/terraform-exec v0.17.3 // indirect + github.com/hashicorp/terraform-plugin-framework v1.1.1 // indirect + github.com/hashicorp/terraform-plugin-framework-validators v0.9.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.14.3 // indirect github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect + github.com/hashicorp/terraform-registry-address v0.1.0 // indirect + github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect + github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect github.com/iancoleman/strcase v0.2.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-ps v1.0.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/mitchellh/hashstructure v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/muvaf/typewriter v0.0.0-20210910160850-80e49fe1eb32 // indirect + github.com/oklog/run v1.0.0 // indirect github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/tmccombs/hcl2json v0.3.3 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect - github.com/vmihailenco/tagparser v0.1.1 // indirect + github.com/vmihailenco/tagparser v0.1.2 // indirect github.com/yuin/goldmark v1.4.13 // indirect github.com/zclconf/go-cty v1.11.0 // indirect + github.com/zclconf/go-cty-yaml v1.0.3 // indirect + go.opencensus.io v0.24.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect + golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect + golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/term v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.14.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect + google.golang.org/api v0.132.0 // indirect google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect diff --git a/go.sum b/go.sum index d87618e46..c5bad31eb 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +bitbucket.org/creachadair/stringset v0.0.8 h1:gQqe4vs8XWgMyijfyKE6K8o4TcyGGrRXe0JvHgx5H+M= +bitbucket.org/creachadair/stringset v0.0.8/go.mod h1:AgthVMyMxC/6FK1KBJ2ALdqkZObGN8hOetgpwXyMn34= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -17,14 +19,26 @@ cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHOb cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= +cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= +cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/bigtable v1.19.0 h1:wiq9LT0kukfInzvy1joMDijCw/OD1UChpSbORXYn0LI= +cloud.google.com/go/bigtable v1.19.0/go.mod h1:xl5kPa8PTkJjdBxg6qdGH88464nNqmbISHSRU+D2yFE= +cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= +cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/iam v1.1.1 h1:lW7fzj15aVIXYHREOqjRBV9PsH0Z6u8Y46a1YGvQP4Y= +cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/longrunning v0.5.1 h1:Fr7TXftcqTudoyRJa113hyaqlGdiBQkp0Gq7tErFDWI= +cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -40,6 +54,15 @@ dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0 h1:hASUAck0/5j84kejIHGJjipjUzFHiN5edNMobKwj2HA= +github.com/GoogleCloudPlatform/declarative-resource-client-library v1.44.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= +github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= +github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= +github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= @@ -48,20 +71,30 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antchfx/htmlquery v1.2.4 h1:qLteofCMe/KGovBI6SQgmou2QNyedFUW+pE+BpeZ494= github.com/antchfx/htmlquery v1.2.4/go.mod h1:2xO6iu3EVWs7R2JYqBbp8YzG50gj/ofqs5/0VZoDZLc= github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8= github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= +github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= +github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -71,27 +104,44 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe h1:QQ3GSy+MqSHxm/d8nCtnAiZdYFd45cYZPs8vOOIYKfk= +github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creachadair/staticfile v0.1.2/go.mod h1:a3qySzCIXEprDGxk6tSxSI+dBBdLzqeBOMhZ+o2d3pM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crossplane/crossplane-runtime v1.14.1 h1:TCa7R1N4bDGHjsLhiRxR/mUhwmistlMACHm0kiiYKck= github.com/crossplane/crossplane-runtime v1.14.1/go.mod h1:aOP+5W2wKpvthVs3pFNbVOe1jwrKYbJho0ThGNCVz9o= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 h1:HigXs5tEQxWz0fcj8hzbU2UAZgEM7wPe0XRFOsrtF8Y= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79/go.mod h1:+e4OaFlOcmr0JvINHl/yvEYBrZawzTgj6pQumOH1SS0= -github.com/crossplane/upjet v0.11.0-rc.0.0.20231012093706-c4a76d2a7505 h1:eCmYgfRopVn6r8RM1Ra4XQAPwVsjTGfktBj2Dk7yy+Y= -github.com/crossplane/upjet v0.11.0-rc.0.0.20231012093706-c4a76d2a7505/go.mod h1:Ov+eoYS2n0Zge/E50zm65meOTYbAHnU6jPt27fQrpbc= +github.com/crossplane/upjet v1.0.0 h1:/R509m+c5XTLsd9oXTEaLj2yIbM/EUmG34XOou1dugM= +github.com/crossplane/upjet v1.0.0/go.mod h1:t9etxIdYaxgyvFPBToikm5zBHi8RIpX8N4mTH77lQFM= github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw= github.com/dave/jennifer v1.4.1/go.mod h1:7jEdnm+qBcxl8PC0zyp7vxcpSRnzXSt9r39tpTVGlwA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= +github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.11.1 h1:wSUXTlLfiAQRWs2F+p+EKOY9rUyis1MyGqJ2DIk5HpM= +github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= @@ -100,11 +150,28 @@ github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwo github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 h1:R+19WKQClnfMXS60cP5BmMe1wjZ4u0evY2p2Ar0ZTXo= +github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4/go.mod h1:GeIq9qoE43YdGnDXURnmKTnGg15pQz4mYkXSTChbneI= +github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92 h1:EipXK6U05IQ2wtuFRn4k3h0+2lXypzItoXGVyf4r9Io= +github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92/go.mod h1:w9RqFVO2BM3xwWEcAB8Fwp0OviTBBEiRmSBDfbXnd3w= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= +github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= +github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= +github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= +github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= +github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -116,6 +183,7 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M= @@ -125,6 +193,8 @@ github.com/gobuffalo/flect v1.0.2/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnD github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= +github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -155,11 +225,13 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/addlicense v0.0.0-20210428195630-6d92264d7170/go.mod h1:EMjYTRimagHs1FwlIqKyX3wAM0u3rA+McvlIIWmSamA= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -170,11 +242,15 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932 h1:5/4TSDzpDnHQ8rKEEQBjRlYx77mHOvXu08oGchxej7o= +github.com/google/go-cpy v0.0.0-20211218193943-a9c933c06932/go.mod h1:cC6EdPbj/17GFCPDK39NRarlMI+kt+O60S12cNB5J9Y= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -193,59 +269,104 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98 h1:pUa4ghanp6q4IJHwE9RwLgmVFfReJN+KbQ8ExNEUUoQ= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= +github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= +github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= +github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw= github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM= +github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hc-install v0.4.0 h1:cZkRFr1WVa0Ty6x5fTvL1TuO1flul231rWkGH92oYYk= +github.com/hashicorp/hc-install v0.4.0/go.mod h1:5d155H8EC5ewegao9A4PUTMNPZaq+TbOzkJJZ4vrXeI= github.com/hashicorp/hcl/v2 v2.9.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= github.com/hashicorp/hcl/v2 v2.14.1 h1:x0BpjfZ+CYdbiz+8yZTQ+gdLO7IXvOut7Da+XJayx34= github.com/hashicorp/hcl/v2 v2.14.1/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/terraform-exec v0.17.3 h1:MX14Kvnka/oWGmIkyuyvL6POx25ZmKrjlaclkx3eErU= +github.com/hashicorp/terraform-exec v0.17.3/go.mod h1:+NELG0EqQekJzhvikkeQsOAZpsw0cv/03rbeQJqscAI= github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= -github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= -github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= +github.com/hashicorp/terraform-plugin-framework v1.1.1 h1:PbnEKHsIU8KTTzoztHQGgjZUWx7Kk8uGtpGMMc1p+oI= +github.com/hashicorp/terraform-plugin-framework v1.1.1/go.mod h1:DyZPxQA+4OKK5ELxFIIcqggcszqdWWUpTLPHAhS/tkY= +github.com/hashicorp/terraform-plugin-framework-validators v0.9.0 h1:LYz4bXh3t7bTEydXOmPDPupRRnA480B/9+jV8yZvxBA= +github.com/hashicorp/terraform-plugin-framework-validators v0.9.0/go.mod h1:+BVERsnfdlhYR2YkXMBtPnmn9UsL19U3qUtSZ+Y/5MY= +github.com/hashicorp/terraform-plugin-go v0.14.3 h1:nlnJ1GXKdMwsC8g1Nh05tK2wsC3+3BL/DBBxFEki+j0= +github.com/hashicorp/terraform-plugin-go v0.14.3/go.mod h1:7ees7DMZ263q8wQ6E4RdIdR6nHHJtrdt4ogX5lPkX1A= github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= +github.com/hashicorp/terraform-plugin-mux v0.8.0 h1:WCTP66mZ+iIaIrCNJnjPEYnVjawTshnDJu12BcXK1EI= github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 h1:FtCLTiTcykdsURXPt/ku7fYXm3y19nbzbZcUxHx9RbI= github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0/go.mod h1:80wf5oad1tW+oLnbXS4UTYmDCrl7BuN1Q+IA91X1a4Y= +github.com/hashicorp/terraform-provider-google v1.20.1-0.20230807163356-c1a5133299b4 h1:rJNfhKGcXD9dDN6ebiMStrtWZ5HzjaLz5MNt0NJ94lY= +github.com/hashicorp/terraform-provider-google v1.20.1-0.20230807163356-c1a5133299b4/go.mod h1:l+xWrh5x5jUY9J1uQEU4ujOdsOTQl7H7hrLwzAWzYGA= +github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U= +github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A= +github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= +github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= +github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= +github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -258,6 +379,7 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -271,6 +393,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc= github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= @@ -278,6 +402,8 @@ github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/mitchellh/hashstructure v1.1.0 h1:P6P1hdjqAAknpY/M1CGipelZgp+4y9ja9kmUZPXP+H0= +github.com/mitchellh/hashstructure v1.1.0/go.mod h1:xUDAozZz0Wmdiufv0uyhnHkUTN6/6d8ulp4AwfLKrmA= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= @@ -291,11 +417,14 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/muvaf/typewriter v0.0.0-20210910160850-80e49fe1eb32 h1:yBQlHXLeUJL3TWVmzup5uT3wG5FLxhiTAiTsmNVocys= github.com/muvaf/typewriter v0.0.0-20210910160850-80e49fe1eb32/go.mod h1:SAAdeMEiFXR8LcHffvIdiLI1w243DCH2DuHq7UrA5YQ= -github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -311,11 +440,18 @@ github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdO github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= @@ -324,6 +460,7 @@ github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -335,7 +472,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ= github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -343,8 +480,11 @@ github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaU github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc= +github.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= +github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -352,6 +492,7 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.8.1/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= @@ -359,29 +500,44 @@ github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uU github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0= github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= +github.com/zclconf/go-cty-yaml v1.0.3 h1:og/eOQ7lvA/WWhHGFETVWNduJM7Rjsv2RRpx1sdFMLc= +github.com/zclconf/go-cty-yaml v1.0.3/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -418,6 +574,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -433,6 +590,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -450,11 +608,15 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -479,17 +641,22 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -514,19 +681,26 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -538,6 +712,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -596,12 +771,15 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -623,6 +801,8 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.132.0 h1:8t2/+qZ26kAOGSmOiHwVycqVaDg7q3JDILrNi/Z6rvc= +google.golang.org/api v0.132.0/go.mod h1:AeTBC6GpJnJSRJjktDcPX0QwtS8pGYZOV6MSuSCusw0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -652,8 +832,10 @@ google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= @@ -667,6 +849,10 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= +google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= +google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -682,9 +868,12 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -705,14 +894,21 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -741,6 +937,7 @@ k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5Ohx k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/hack/main.go.tmpl b/hack/main.go.tmpl index fb134ecb4..59099c0e4 100644 --- a/hack/main.go.tmpl +++ b/hack/main.go.tmpl @@ -116,6 +116,9 @@ func main() { terraform.WithSharedProviderOptions(terraform.WithNativeProviderPath(*nativeProviderPath), terraform.WithNativeProviderName("registry.terraform.io/"+*nativeProviderSource))) } + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") o := tjcontroller.Options{ Options: xpcontroller.Options{ Logger: log, @@ -124,9 +127,10 @@ func main() { MaxConcurrentReconciles: *maxReconcileRate, Features: &feature.Flags{}, }, - Provider: config.GetProvider(), - SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, scheduler), - PollJitter: pollJitter, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(*terraformVersion, *nativeProviderSource, *providerVersion, provider.TerraformProvider, scheduler), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(log), } if *enableManagementPolicies { @@ -150,7 +154,7 @@ func main() { } // Ensure default store config exists. - kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(context.Background(), &v1alpha1.StoreConfig{ + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ TypeMeta: metav1.TypeMeta{}, ObjectMeta: metav1.ObjectMeta{ Name: "default", diff --git a/internal/clients/gcp.go b/internal/clients/gcp.go index f597f2562..547c4ac96 100644 --- a/internal/clients/gcp.go +++ b/internal/clients/gcp.go @@ -25,6 +25,8 @@ import ( "github.com/crossplane/crossplane-runtime/pkg/fieldpath" "github.com/crossplane/crossplane-runtime/pkg/resource" "github.com/crossplane/upjet/pkg/terraform" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + terraform2 "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/pkg/errors" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" @@ -94,7 +96,7 @@ func constructFederatedCredentials(providerID, serviceAccount string) ([]byte, e // returns Terraform provider setup configuration // NOTE(hasheddan): this function is slightly over our cyclomatic complexity // goal. Consider refactoring before adding new branches. -func TerraformSetupBuilder(version, providerSource, providerVersion string, scheduler terraform.ProviderScheduler) terraform.SetupFn { //nolint:gocyclo +func TerraformSetupBuilder(version, providerSource, providerVersion string, tfProvider *schema.Provider, scheduler terraform.ProviderScheduler) terraform.SetupFn { //nolint:gocyclo return func(ctx context.Context, client client.Client, mg resource.Managed) (terraform.Setup, error) { ps := terraform.Setup{ Version: version, @@ -168,6 +170,23 @@ func TerraformSetupBuilder(version, providerSource, providerVersion string, sche ps.Configuration[keyCredentials] = string(data) } - return ps, nil + return ps, errors.Wrap(configureNoForkGCPClient(ctx, &ps, *tfProvider), "failed to configure the no-fork GCP client") } } + +func configureNoForkGCPClient(ctx context.Context, ps *terraform.Setup, p schema.Provider) error { + // Please be aware that this implementation relies on the schema.Provider + // parameter `p` being a non-pointer. This is because normally + // the Terraform plugin SDK normally configures the provider + // only once and using a pointer argument here will cause + // race conditions between resources referring to different + // ProviderConfigs. + diag := p.Configure(ctx, &terraform2.ResourceConfig{ + Config: ps.Configuration, + }) + if diag != nil && diag.HasError() { + return errors.Errorf("failed to configure the provider: %v", diag) + } + ps.Meta = p.Meta() + return nil +} diff --git a/internal/controller/accesscontextmanager/accesslevel/zz_controller.go b/internal/controller/accesscontextmanager/accesslevel/zz_controller.go index 115f0a773..c2fcf9ec9 100755 --- a/internal/controller/accesscontextmanager/accesslevel/zz_controller.go +++ b/internal/controller/accesscontextmanager/accesslevel/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/accesscontextmanager/v1beta1" @@ -48,14 +48,18 @@ 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.AccessLevel_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessLevel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessLevel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_level"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_level"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessLevel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/accesscontextmanager/accesslevelcondition/zz_controller.go b/internal/controller/accesscontextmanager/accesslevelcondition/zz_controller.go index f4d27cfb2..215bc6dd1 100755 --- a/internal/controller/accesscontextmanager/accesslevelcondition/zz_controller.go +++ b/internal/controller/accesscontextmanager/accesslevelcondition/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/accesscontextmanager/v1beta1" @@ -48,14 +48,18 @@ 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.AccessLevelCondition_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessLevelCondition_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessLevelCondition_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_level_condition"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_level_condition"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessLevelCondition_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/accesscontextmanager/accesspolicy/zz_controller.go b/internal/controller/accesscontextmanager/accesspolicy/zz_controller.go index 185691a7c..c7543344c 100755 --- a/internal/controller/accesscontextmanager/accesspolicy/zz_controller.go +++ b/internal/controller/accesscontextmanager/accesspolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/accesscontextmanager/v1beta1" @@ -48,14 +48,18 @@ 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.AccessPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/accesscontextmanager/accesspolicyiammember/zz_controller.go b/internal/controller/accesscontextmanager/accesspolicyiammember/zz_controller.go index 97da65378..330705bec 100755 --- a/internal/controller/accesscontextmanager/accesspolicyiammember/zz_controller.go +++ b/internal/controller/accesscontextmanager/accesspolicyiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/accesscontextmanager/v1beta1" @@ -48,14 +48,18 @@ 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.AccessPolicyIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPolicyIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AccessPolicyIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_policy_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_access_policy_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AccessPolicyIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/accesscontextmanager/serviceperimeter/zz_controller.go b/internal/controller/accesscontextmanager/serviceperimeter/zz_controller.go index 7bed8d347..23223ce44 100755 --- a/internal/controller/accesscontextmanager/serviceperimeter/zz_controller.go +++ b/internal/controller/accesscontextmanager/serviceperimeter/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/accesscontextmanager/v1beta1" @@ -48,14 +48,18 @@ 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.ServicePerimeter_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServicePerimeter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServicePerimeter_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_service_perimeter"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_service_perimeter"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServicePerimeter_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/accesscontextmanager/serviceperimeterresource/zz_controller.go b/internal/controller/accesscontextmanager/serviceperimeterresource/zz_controller.go index 920baf945..5da1e5b25 100755 --- a/internal/controller/accesscontextmanager/serviceperimeterresource/zz_controller.go +++ b/internal/controller/accesscontextmanager/serviceperimeterresource/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/accesscontextmanager/v1beta1" @@ -48,14 +48,18 @@ 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.ServicePerimeterResource_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServicePerimeterResource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServicePerimeterResource_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_service_perimeter_resource"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_access_context_manager_service_perimeter_resource"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServicePerimeterResource_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/activedirectory/domain/zz_controller.go b/internal/controller/activedirectory/domain/zz_controller.go index 6a2cbea88..6a625294f 100755 --- a/internal/controller/activedirectory/domain/zz_controller.go +++ b/internal/controller/activedirectory/domain/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/activedirectory/v1beta1" @@ -48,14 +48,18 @@ 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.Domain_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Domain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_active_directory_domain"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_active_directory_domain"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Domain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/alloydb/backup/zz_controller.go b/internal/controller/alloydb/backup/zz_controller.go index 0f505a6c3..23dc7c50e 100755 --- a/internal/controller/alloydb/backup/zz_controller.go +++ b/internal/controller/alloydb/backup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/alloydb/v1beta1" @@ -49,14 +49,18 @@ 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.Backup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Backup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Backup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_alloydb_backup"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_alloydb_backup"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Backup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/alloydb/cluster/zz_controller.go b/internal/controller/alloydb/cluster/zz_controller.go index 8e86febc8..496de63f0 100755 --- a/internal/controller/alloydb/cluster/zz_controller.go +++ b/internal/controller/alloydb/cluster/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/alloydb/v1beta1" @@ -49,14 +49,18 @@ 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.Cluster_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_alloydb_cluster"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_alloydb_cluster"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/alloydb/instance/zz_controller.go b/internal/controller/alloydb/instance/zz_controller.go index c30b005d6..b8e76539d 100755 --- a/internal/controller/alloydb/instance/zz_controller.go +++ b/internal/controller/alloydb/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/alloydb/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_alloydb_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_alloydb_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/apigee/envgroup/zz_controller.go b/internal/controller/apigee/envgroup/zz_controller.go index 0bd3512f8..7519dd3c7 100755 --- a/internal/controller/apigee/envgroup/zz_controller.go +++ b/internal/controller/apigee/envgroup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/apigee/v1beta1" @@ -49,14 +49,18 @@ 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.Envgroup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Envgroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Envgroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_envgroup"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_apigee_envgroup"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Envgroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/apigee/environment/zz_controller.go b/internal/controller/apigee/environment/zz_controller.go index 4ffd3cdd0..8b4200de6 100755 --- a/internal/controller/apigee/environment/zz_controller.go +++ b/internal/controller/apigee/environment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/apigee/v1beta1" @@ -49,14 +49,18 @@ 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)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_environment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_apigee_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.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/apigee/environmentiammember/zz_controller.go b/internal/controller/apigee/environmentiammember/zz_controller.go index f3d3b56f0..4b44b5905 100755 --- a/internal/controller/apigee/environmentiammember/zz_controller.go +++ b/internal/controller/apigee/environmentiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/apigee/v1beta1" @@ -48,14 +48,18 @@ 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.EnvironmentIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EnvironmentIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EnvironmentIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_environment_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_apigee_environment_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EnvironmentIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/apigee/instance/zz_controller.go b/internal/controller/apigee/instance/zz_controller.go index 5c944648f..3ff2be80a 100755 --- a/internal/controller/apigee/instance/zz_controller.go +++ b/internal/controller/apigee/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/apigee/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_apigee_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/apigee/nataddress/zz_controller.go b/internal/controller/apigee/nataddress/zz_controller.go index b750ba05d..6c1688c7e 100755 --- a/internal/controller/apigee/nataddress/zz_controller.go +++ b/internal/controller/apigee/nataddress/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/apigee/v1beta1" @@ -49,14 +49,18 @@ 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.NATAddress_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NATAddress_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NATAddress_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_nat_address"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_apigee_nat_address"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NATAddress_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/apigee/organization/zz_controller.go b/internal/controller/apigee/organization/zz_controller.go index 3d100e45a..9ef4a08d2 100755 --- a/internal/controller/apigee/organization/zz_controller.go +++ b/internal/controller/apigee/organization/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/apigee/v1beta1" @@ -48,14 +48,18 @@ 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.Organization_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Organization_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Organization_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_apigee_organization"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_apigee_organization"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Organization_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/appengine/application/zz_controller.go b/internal/controller/appengine/application/zz_controller.go index 3359d407c..110aa5f06 100755 --- a/internal/controller/appengine/application/zz_controller.go +++ b/internal/controller/appengine/application/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/appengine/v1beta1" @@ -48,14 +48,18 @@ 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.Application_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Application_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_application"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_app_engine_application"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Application_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/appengine/applicationurldispatchrules/zz_controller.go b/internal/controller/appengine/applicationurldispatchrules/zz_controller.go index c18a0863e..0ed51abd5 100755 --- a/internal/controller/appengine/applicationurldispatchrules/zz_controller.go +++ b/internal/controller/appengine/applicationurldispatchrules/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/appengine/v1beta1" @@ -49,14 +49,18 @@ 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.ApplicationURLDispatchRules_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ApplicationURLDispatchRules_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ApplicationURLDispatchRules_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_application_url_dispatch_rules"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_app_engine_application_url_dispatch_rules"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ApplicationURLDispatchRules_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/appengine/firewallrule/zz_controller.go b/internal/controller/appengine/firewallrule/zz_controller.go index 331c5569e..225139ba7 100755 --- a/internal/controller/appengine/firewallrule/zz_controller.go +++ b/internal/controller/appengine/firewallrule/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/appengine/v1beta1" @@ -48,14 +48,18 @@ 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.FirewallRule_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_firewall_rule"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_app_engine_firewall_rule"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FirewallRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/appengine/servicenetworksettings/zz_controller.go b/internal/controller/appengine/servicenetworksettings/zz_controller.go index da9b67c61..f225c41a9 100755 --- a/internal/controller/appengine/servicenetworksettings/zz_controller.go +++ b/internal/controller/appengine/servicenetworksettings/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/appengine/v1beta1" @@ -48,14 +48,18 @@ 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.ServiceNetworkSettings_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceNetworkSettings_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceNetworkSettings_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_service_network_settings"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_app_engine_service_network_settings"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceNetworkSettings_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/appengine/standardappversion/zz_controller.go b/internal/controller/appengine/standardappversion/zz_controller.go index c92959137..1207b8faf 100755 --- a/internal/controller/appengine/standardappversion/zz_controller.go +++ b/internal/controller/appengine/standardappversion/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/appengine/v1beta1" @@ -49,14 +49,18 @@ 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.StandardAppVersion_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StandardAppVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StandardAppVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_app_engine_standard_app_version"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_app_engine_standard_app_version"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StandardAppVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/artifact/registryrepository/zz_controller.go b/internal/controller/artifact/registryrepository/zz_controller.go index a4c94c2fa..3864bfe80 100755 --- a/internal/controller/artifact/registryrepository/zz_controller.go +++ b/internal/controller/artifact/registryrepository/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/artifact/v1beta1" @@ -49,14 +49,18 @@ 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.RegistryRepository_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegistryRepository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegistryRepository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_artifact_registry_repository"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_artifact_registry_repository"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegistryRepository_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/artifact/registryrepositoryiammember/zz_controller.go b/internal/controller/artifact/registryrepositoryiammember/zz_controller.go index d549167eb..c1814c954 100755 --- a/internal/controller/artifact/registryrepositoryiammember/zz_controller.go +++ b/internal/controller/artifact/registryrepositoryiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/artifact/v1beta1" @@ -48,14 +48,18 @@ 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.RegistryRepositoryIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegistryRepositoryIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegistryRepositoryIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_artifact_registry_repository_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_artifact_registry_repository_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegistryRepositoryIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/beyondcorp/appconnection/zz_controller.go b/internal/controller/beyondcorp/appconnection/zz_controller.go index 9f0156abe..f9cf28860 100755 --- a/internal/controller/beyondcorp/appconnection/zz_controller.go +++ b/internal/controller/beyondcorp/appconnection/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/beyondcorp/v1beta1" @@ -48,14 +48,18 @@ 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.AppConnection_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppConnection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppConnection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_connection"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_connection"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppConnection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/beyondcorp/appconnector/zz_controller.go b/internal/controller/beyondcorp/appconnector/zz_controller.go index c0d07484f..86fe4807b 100755 --- a/internal/controller/beyondcorp/appconnector/zz_controller.go +++ b/internal/controller/beyondcorp/appconnector/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/beyondcorp/v1beta1" @@ -49,14 +49,18 @@ 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.AppConnector_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppConnector_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppConnector_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_connector"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_connector"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppConnector_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/beyondcorp/appgateway/zz_controller.go b/internal/controller/beyondcorp/appgateway/zz_controller.go index 9c8050218..161f2238f 100755 --- a/internal/controller/beyondcorp/appgateway/zz_controller.go +++ b/internal/controller/beyondcorp/appgateway/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/beyondcorp/v1beta1" @@ -49,14 +49,18 @@ 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.AppGateway_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_gateway"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_beyondcorp_app_gateway"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go b/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go index 09b6afc9a..c8c9c01fc 100755 --- a/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go +++ b/internal/controller/bigquery/analyticshubdataexchange/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.AnalyticsHubDataExchange_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AnalyticsHubDataExchange_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AnalyticsHubDataExchange_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_data_exchange"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_data_exchange"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AnalyticsHubDataExchange_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go b/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go index c944f0994..0f3cc8901 100755 --- a/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go +++ b/internal/controller/bigquery/analyticshubdataexchangeiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.AnalyticsHubDataExchangeIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AnalyticsHubDataExchangeIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AnalyticsHubDataExchangeIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_data_exchange_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_data_exchange_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AnalyticsHubDataExchangeIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/analyticshublisting/zz_controller.go b/internal/controller/bigquery/analyticshublisting/zz_controller.go index 2f8b064ab..6422d17bd 100755 --- a/internal/controller/bigquery/analyticshublisting/zz_controller.go +++ b/internal/controller/bigquery/analyticshublisting/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.AnalyticsHubListing_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AnalyticsHubListing_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AnalyticsHubListing_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_listing"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_analytics_hub_listing"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AnalyticsHubListing_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/connection/zz_controller.go b/internal/controller/bigquery/connection/zz_controller.go index 02aae475e..0fd2425e5 100755 --- a/internal/controller/bigquery/connection/zz_controller.go +++ b/internal/controller/bigquery/connection/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.Connection_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_connection"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_connection"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/dataset/zz_controller.go b/internal/controller/bigquery/dataset/zz_controller.go index ccd7e3b2a..29dcae2e7 100755 --- a/internal/controller/bigquery/dataset/zz_controller.go +++ b/internal/controller/bigquery/dataset/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.Dataset_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dataset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dataset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Dataset_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/datasetaccess/zz_controller.go b/internal/controller/bigquery/datasetaccess/zz_controller.go index 8a3ee51e0..4caf87905 100755 --- a/internal/controller/bigquery/datasetaccess/zz_controller.go +++ b/internal/controller/bigquery/datasetaccess/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.DatasetAccess_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetAccess_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetAccess_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_access"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_access"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DatasetAccess_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/datasetiambinding/zz_controller.go b/internal/controller/bigquery/datasetiambinding/zz_controller.go index 23fd51e88..417c765a5 100755 --- a/internal/controller/bigquery/datasetiambinding/zz_controller.go +++ b/internal/controller/bigquery/datasetiambinding/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.DatasetIAMBinding_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_binding"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_binding"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DatasetIAMBinding_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/datasetiammember/zz_controller.go b/internal/controller/bigquery/datasetiammember/zz_controller.go index 5f6d79867..ad7ef7329 100755 --- a/internal/controller/bigquery/datasetiammember/zz_controller.go +++ b/internal/controller/bigquery/datasetiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.DatasetIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DatasetIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/datasetiampolicy/zz_controller.go b/internal/controller/bigquery/datasetiampolicy/zz_controller.go index 088548fa4..5ab7592ee 100755 --- a/internal/controller/bigquery/datasetiampolicy/zz_controller.go +++ b/internal/controller/bigquery/datasetiampolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.DatasetIAMPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_dataset_iam_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DatasetIAMPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/datatransferconfig/zz_controller.go b/internal/controller/bigquery/datatransferconfig/zz_controller.go index 6e64b325e..44da13a8f 100755 --- a/internal/controller/bigquery/datatransferconfig/zz_controller.go +++ b/internal/controller/bigquery/datatransferconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.DataTransferConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataTransferConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DataTransferConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_data_transfer_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_data_transfer_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DataTransferConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/job/zz_controller.go b/internal/controller/bigquery/job/zz_controller.go index b911291d5..a98006564 100755 --- a/internal/controller/bigquery/job/zz_controller.go +++ b/internal/controller/bigquery/job/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.Job_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_job"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Job_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/reservation/zz_controller.go b/internal/controller/bigquery/reservation/zz_controller.go index 4c3bf6f7e..5d3b502b5 100755 --- a/internal/controller/bigquery/reservation/zz_controller.go +++ b/internal/controller/bigquery/reservation/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.Reservation_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Reservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Reservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_reservation"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_reservation"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Reservation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/reservationassignment/zz_controller.go b/internal/controller/bigquery/reservationassignment/zz_controller.go index 244af4b83..7c89cf560 100755 --- a/internal/controller/bigquery/reservationassignment/zz_controller.go +++ b/internal/controller/bigquery/reservationassignment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.ReservationAssignment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReservationAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReservationAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_reservation_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_reservation_assignment"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ReservationAssignment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/routine/zz_controller.go b/internal/controller/bigquery/routine/zz_controller.go index af09453d3..0ae84482b 100755 --- a/internal/controller/bigquery/routine/zz_controller.go +++ b/internal/controller/bigquery/routine/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.Routine_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Routine_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Routine_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_routine"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_routine"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Routine_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/table/zz_controller.go b/internal/controller/bigquery/table/zz_controller.go index 06633b90c..2acb8723a 100755 --- a/internal/controller/bigquery/table/zz_controller.go +++ b/internal/controller/bigquery/table/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.Table_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_table"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/tableiambinding/zz_controller.go b/internal/controller/bigquery/tableiambinding/zz_controller.go index 0eb2ee5b7..b305d7f59 100755 --- a/internal/controller/bigquery/tableiambinding/zz_controller.go +++ b/internal/controller/bigquery/tableiambinding/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.TableIAMBinding_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_binding"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_binding"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableIAMBinding_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/tableiammember/zz_controller.go b/internal/controller/bigquery/tableiammember/zz_controller.go index de45fb4fc..7eaed62b0 100755 --- a/internal/controller/bigquery/tableiammember/zz_controller.go +++ b/internal/controller/bigquery/tableiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -49,14 +49,18 @@ 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.TableIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigquery/tableiampolicy/zz_controller.go b/internal/controller/bigquery/tableiampolicy/zz_controller.go index 53b1712f9..23db26b63 100755 --- a/internal/controller/bigquery/tableiampolicy/zz_controller.go +++ b/internal/controller/bigquery/tableiampolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigquery/v1beta1" @@ -48,14 +48,18 @@ 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.TableIAMPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigquery_table_iam_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableIAMPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/appprofile/zz_controller.go b/internal/controller/bigtable/appprofile/zz_controller.go index 25ecce723..dedd49417 100755 --- a/internal/controller/bigtable/appprofile/zz_controller.go +++ b/internal/controller/bigtable/appprofile/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.AppProfile_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_app_profile"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_app_profile"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go b/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go index dc3884942..720fb1796 100755 --- a/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go +++ b/internal/controller/bigtable/garbagecollectionpolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -48,14 +48,18 @@ 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.GarbageCollectionPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GarbageCollectionPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GarbageCollectionPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_gc_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_gc_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GarbageCollectionPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/instance/zz_controller.go b/internal/controller/bigtable/instance/zz_controller.go index d58b9e183..6cc08f171 100755 --- a/internal/controller/bigtable/instance/zz_controller.go +++ b/internal/controller/bigtable/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/instanceiambinding/zz_controller.go b/internal/controller/bigtable/instanceiambinding/zz_controller.go index a420cdbf3..d84500513 100755 --- a/internal/controller/bigtable/instanceiambinding/zz_controller.go +++ b/internal/controller/bigtable/instanceiambinding/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.InstanceIAMBinding_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_binding"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_binding"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceIAMBinding_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/instanceiammember/zz_controller.go b/internal/controller/bigtable/instanceiammember/zz_controller.go index 10b913462..3b7d00af0 100755 --- a/internal/controller/bigtable/instanceiammember/zz_controller.go +++ b/internal/controller/bigtable/instanceiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.InstanceIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/instanceiampolicy/zz_controller.go b/internal/controller/bigtable/instanceiampolicy/zz_controller.go index 118e4984f..833f6f351 100755 --- a/internal/controller/bigtable/instanceiampolicy/zz_controller.go +++ b/internal/controller/bigtable/instanceiampolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.InstanceIAMPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_instance_iam_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceIAMPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/table/zz_controller.go b/internal/controller/bigtable/table/zz_controller.go index 979ef6059..8663b4994 100755 --- a/internal/controller/bigtable/table/zz_controller.go +++ b/internal/controller/bigtable/table/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.Table_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Table_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_table"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Table_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/tableiambinding/zz_controller.go b/internal/controller/bigtable/tableiambinding/zz_controller.go index e41af28d1..935d6a21a 100755 --- a/internal/controller/bigtable/tableiambinding/zz_controller.go +++ b/internal/controller/bigtable/tableiambinding/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.TableIAMBinding_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_binding"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_binding"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableIAMBinding_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/tableiammember/zz_controller.go b/internal/controller/bigtable/tableiammember/zz_controller.go index 482bfc2fa..f416406f4 100755 --- a/internal/controller/bigtable/tableiammember/zz_controller.go +++ b/internal/controller/bigtable/tableiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.TableIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/bigtable/tableiampolicy/zz_controller.go b/internal/controller/bigtable/tableiampolicy/zz_controller.go index 53b4d58a5..73cfb4686 100755 --- a/internal/controller/bigtable/tableiampolicy/zz_controller.go +++ b/internal/controller/bigtable/tableiampolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/bigtable/v1beta1" @@ -49,14 +49,18 @@ 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.TableIAMPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TableIAMPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_bigtable_table_iam_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TableIAMPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/binaryauthorization/attestor/zz_controller.go b/internal/controller/binaryauthorization/attestor/zz_controller.go index b492c7fb2..ed44920ad 100755 --- a/internal/controller/binaryauthorization/attestor/zz_controller.go +++ b/internal/controller/binaryauthorization/attestor/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/binaryauthorization/v1beta1" @@ -49,14 +49,18 @@ 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.Attestor_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Attestor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Attestor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_binary_authorization_attestor"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_binary_authorization_attestor"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Attestor_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/binaryauthorization/policy/zz_controller.go b/internal/controller/binaryauthorization/policy/zz_controller.go index d3c789c4a..9e307dd21 100755 --- a/internal/controller/binaryauthorization/policy/zz_controller.go +++ b/internal/controller/binaryauthorization/policy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/binaryauthorization/v1beta1" @@ -49,14 +49,18 @@ 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.Policy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_binary_authorization_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_binary_authorization_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/certificatemanager/certificate/zz_controller.go b/internal/controller/certificatemanager/certificate/zz_controller.go index 50a71b6fe..dd37e70d8 100755 --- a/internal/controller/certificatemanager/certificate/zz_controller.go +++ b/internal/controller/certificatemanager/certificate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/certificatemanager/v1beta1" @@ -49,14 +49,18 @@ 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.Certificate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/certificatemanager/certificatemap/zz_controller.go b/internal/controller/certificatemanager/certificatemap/zz_controller.go index bc1995ebd..0f4072d02 100755 --- a/internal/controller/certificatemanager/certificatemap/zz_controller.go +++ b/internal/controller/certificatemanager/certificatemap/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/certificatemanager/v1beta1" @@ -49,14 +49,18 @@ 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.CertificateMap_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateMap_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateMap_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate_map"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate_map"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateMap_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/certificatemanager/certificatemapentry/zz_controller.go b/internal/controller/certificatemanager/certificatemapentry/zz_controller.go index 25541c187..53a45dfbf 100755 --- a/internal/controller/certificatemanager/certificatemapentry/zz_controller.go +++ b/internal/controller/certificatemanager/certificatemapentry/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/certificatemanager/v1beta1" @@ -49,14 +49,18 @@ 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.CertificateMapEntry_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateMapEntry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateMapEntry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate_map_entry"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_certificate_map_entry"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateMapEntry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/certificatemanager/dnsauthorization/zz_controller.go b/internal/controller/certificatemanager/dnsauthorization/zz_controller.go index 394351a0b..6ebbb9865 100755 --- a/internal/controller/certificatemanager/dnsauthorization/zz_controller.go +++ b/internal/controller/certificatemanager/dnsauthorization/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/certificatemanager/v1beta1" @@ -49,14 +49,18 @@ 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.DNSAuthorization_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DNSAuthorization_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DNSAuthorization_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_dns_authorization"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_certificate_manager_dns_authorization"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DNSAuthorization_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloud/idsendpoint/zz_controller.go b/internal/controller/cloud/idsendpoint/zz_controller.go index 36b643f68..aa44e66c6 100755 --- a/internal/controller/cloud/idsendpoint/zz_controller.go +++ b/internal/controller/cloud/idsendpoint/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloud/v1beta1" @@ -48,14 +48,18 @@ 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.IdsEndpoint_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IdsEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.IdsEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_ids_endpoint"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_ids_endpoint"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.IdsEndpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudbuild/trigger/zz_controller.go b/internal/controller/cloudbuild/trigger/zz_controller.go index de24ec4a5..bc4bc38ad 100755 --- a/internal/controller/cloudbuild/trigger/zz_controller.go +++ b/internal/controller/cloudbuild/trigger/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudbuild/v1beta1" @@ -48,14 +48,18 @@ 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.Trigger_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudbuild_trigger"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloudbuild_trigger"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trigger_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudbuild/workerpool/zz_controller.go b/internal/controller/cloudbuild/workerpool/zz_controller.go index 4aa538faf..712c5ef55 100755 --- a/internal/controller/cloudbuild/workerpool/zz_controller.go +++ b/internal/controller/cloudbuild/workerpool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudbuild/v1beta1" @@ -49,14 +49,18 @@ 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.WorkerPool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkerPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkerPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudbuild_worker_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloudbuild_worker_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkerPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudfunctions/function/zz_controller.go b/internal/controller/cloudfunctions/function/zz_controller.go index 7bb11d5bd..1378f9839 100755 --- a/internal/controller/cloudfunctions/function/zz_controller.go +++ b/internal/controller/cloudfunctions/function/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudfunctions/v1beta1" @@ -49,14 +49,18 @@ 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.Function_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions_function"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions_function"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudfunctions/functioniammember/zz_controller.go b/internal/controller/cloudfunctions/functioniammember/zz_controller.go index 1f868b282..70633f604 100755 --- a/internal/controller/cloudfunctions/functioniammember/zz_controller.go +++ b/internal/controller/cloudfunctions/functioniammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudfunctions/v1beta1" @@ -48,14 +48,18 @@ 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.FunctionIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FunctionIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FunctionIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions_function_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions_function_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FunctionIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudfunctions2/function/zz_controller.go b/internal/controller/cloudfunctions2/function/zz_controller.go index 6fc44411f..bb2d78cd5 100755 --- a/internal/controller/cloudfunctions2/function/zz_controller.go +++ b/internal/controller/cloudfunctions2/function/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudfunctions2/v1beta1" @@ -49,14 +49,18 @@ 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.Function_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Function_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions2_function"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloudfunctions2_function"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Function_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudiot/device/zz_controller.go b/internal/controller/cloudiot/device/zz_controller.go index 02d86fca3..12e945e51 100755 --- a/internal/controller/cloudiot/device/zz_controller.go +++ b/internal/controller/cloudiot/device/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudiot/v1beta1" @@ -49,14 +49,18 @@ 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.Device_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Device_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Device_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudiot_device"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloudiot_device"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Device_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudiot/registry/zz_controller.go b/internal/controller/cloudiot/registry/zz_controller.go index 178c739aa..b2cc5b5d8 100755 --- a/internal/controller/cloudiot/registry/zz_controller.go +++ b/internal/controller/cloudiot/registry/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudiot/v1beta1" @@ -48,14 +48,18 @@ 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.Registry_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloudiot_registry"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloudiot_registry"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Registry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/folder/zz_controller.go b/internal/controller/cloudplatform/folder/zz_controller.go index b7cb6b475..3711bdab6 100755 --- a/internal/controller/cloudplatform/folder/zz_controller.go +++ b/internal/controller/cloudplatform/folder/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.Folder_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Folder_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Folder_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_folder"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_folder"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Folder_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/folderiammember/zz_controller.go b/internal/controller/cloudplatform/folderiammember/zz_controller.go index 81b3a1ca9..7dbb0fdf7 100755 --- a/internal/controller/cloudplatform/folderiammember/zz_controller.go +++ b/internal/controller/cloudplatform/folderiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.FolderIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FolderIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FolderIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_folder_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_folder_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FolderIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go b/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go index 657e154a9..62bef07dd 100755 --- a/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go +++ b/internal/controller/cloudplatform/organizationiamauditconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.OrganizationIAMAuditConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OrganizationIAMAuditConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OrganizationIAMAuditConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_organization_iam_audit_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_organization_iam_audit_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OrganizationIAMAuditConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go b/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go index 188bebc3e..6fd8c11fb 100755 --- a/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go +++ b/internal/controller/cloudplatform/organizationiamcustomrole/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.OrganizationIAMCustomRole_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OrganizationIAMCustomRole_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OrganizationIAMCustomRole_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_organization_iam_custom_role"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_organization_iam_custom_role"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OrganizationIAMCustomRole_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/organizationiammember/zz_controller.go b/internal/controller/cloudplatform/organizationiammember/zz_controller.go index 7385b1fc0..859821f93 100755 --- a/internal/controller/cloudplatform/organizationiammember/zz_controller.go +++ b/internal/controller/cloudplatform/organizationiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.OrganizationIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OrganizationIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OrganizationIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_organization_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_organization_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OrganizationIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/project/zz_controller.go b/internal/controller/cloudplatform/project/zz_controller.go index a5cf466b8..b32140c29 100755 --- a/internal/controller/cloudplatform/project/zz_controller.go +++ b/internal/controller/cloudplatform/project/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.Project_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Project_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Project_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_project"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Project_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go b/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go index b81fd943d..b97f7eb98 100755 --- a/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go +++ b/internal/controller/cloudplatform/projectdefaultserviceaccounts/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectDefaultServiceAccounts_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectDefaultServiceAccounts_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectDefaultServiceAccounts_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_default_service_accounts"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_project_default_service_accounts"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectDefaultServiceAccounts_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go b/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go index acdea6cd6..6ab1214f5 100755 --- a/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go +++ b/internal/controller/cloudplatform/projectiamauditconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectIAMAuditConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectIAMAuditConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectIAMAuditConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_iam_audit_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_project_iam_audit_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectIAMAuditConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go b/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go index 5e344268e..b26505423 100755 --- a/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go +++ b/internal/controller/cloudplatform/projectiamcustomrole/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -49,14 +49,18 @@ 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.ProjectIAMCustomRole_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectIAMCustomRole_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectIAMCustomRole_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_iam_custom_role"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_project_iam_custom_role"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectIAMCustomRole_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/projectiammember/zz_controller.go b/internal/controller/cloudplatform/projectiammember/zz_controller.go index 6991fca12..69cb71806 100755 --- a/internal/controller/cloudplatform/projectiammember/zz_controller.go +++ b/internal/controller/cloudplatform/projectiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_project_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/projectservice/zz_controller.go b/internal/controller/cloudplatform/projectservice/zz_controller.go index ecfddc642..1824d95b4 100755 --- a/internal/controller/cloudplatform/projectservice/zz_controller.go +++ b/internal/controller/cloudplatform/projectservice/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectService_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_project_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go b/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go index b02b788ce..a8d853431 100755 --- a/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go +++ b/internal/controller/cloudplatform/projectusageexportbucket/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectUsageExportBucket_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectUsageExportBucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectUsageExportBucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_usage_export_bucket"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_project_usage_export_bucket"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectUsageExportBucket_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/serviceaccount/zz_controller.go b/internal/controller/cloudplatform/serviceaccount/zz_controller.go index df47fe889..e42a96455 100755 --- a/internal/controller/cloudplatform/serviceaccount/zz_controller.go +++ b/internal/controller/cloudplatform/serviceaccount/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -49,14 +49,18 @@ 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.ServiceAccount_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAccount_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAccount_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_account"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_service_account"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceAccount_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go b/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go index 07646094c..e28d30b3d 100755 --- a/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go +++ b/internal/controller/cloudplatform/serviceaccountiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ServiceAccountIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAccountIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAccountIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_account_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_service_account_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceAccountIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go b/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go index e0720ce89..99823a776 100755 --- a/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go +++ b/internal/controller/cloudplatform/serviceaccountkey/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ServiceAccountKey_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAccountKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAccountKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_account_key"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_service_account_key"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceAccountKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go b/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go index f1311e063..d5834df35 100755 --- a/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go +++ b/internal/controller/cloudplatform/servicenetworkingpeereddnsdomain/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" @@ -49,14 +49,18 @@ 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.ServiceNetworkingPeeredDNSDomain_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceNetworkingPeeredDNSDomain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceNetworkingPeeredDNSDomain_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_networking_peered_dns_domain"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_service_networking_peered_dns_domain"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceNetworkingPeeredDNSDomain_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudrun/domainmapping/zz_controller.go b/internal/controller/cloudrun/domainmapping/zz_controller.go index af7b91a72..baac8a683 100755 --- a/internal/controller/cloudrun/domainmapping/zz_controller.go +++ b/internal/controller/cloudrun/domainmapping/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudrun/v1beta1" @@ -48,14 +48,18 @@ 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.DomainMapping_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainMapping_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DomainMapping_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_domain_mapping"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_run_domain_mapping"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DomainMapping_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudrun/service/zz_controller.go b/internal/controller/cloudrun/service/zz_controller.go index 41921bc2b..97427e7d1 100755 --- a/internal/controller/cloudrun/service/zz_controller.go +++ b/internal/controller/cloudrun/service/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudrun/v1beta1" @@ -49,14 +49,18 @@ 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.Service_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_run_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudrun/serviceiammember/zz_controller.go b/internal/controller/cloudrun/serviceiammember/zz_controller.go index 3fe4c3f9e..ccabaa2b5 100755 --- a/internal/controller/cloudrun/serviceiammember/zz_controller.go +++ b/internal/controller/cloudrun/serviceiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudrun/v1beta1" @@ -48,14 +48,18 @@ 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.ServiceIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_service_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_run_service_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudrun/v2job/zz_controller.go b/internal/controller/cloudrun/v2job/zz_controller.go index c7eff89ae..be18e820e 100755 --- a/internal/controller/cloudrun/v2job/zz_controller.go +++ b/internal/controller/cloudrun/v2job/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudrun/v1beta1" @@ -49,14 +49,18 @@ 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.V2Job_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.V2Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.V2Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_v2_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_run_v2_job"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.V2Job_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudrun/v2service/zz_controller.go b/internal/controller/cloudrun/v2service/zz_controller.go index 11d05dabf..ed9db2cba 100755 --- a/internal/controller/cloudrun/v2service/zz_controller.go +++ b/internal/controller/cloudrun/v2service/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudrun/v1beta1" @@ -49,14 +49,18 @@ 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.V2Service_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.V2Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.V2Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_run_v2_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_run_v2_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.V2Service_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudscheduler/job/zz_controller.go b/internal/controller/cloudscheduler/job/zz_controller.go index 568a2301d..bfb052e37 100755 --- a/internal/controller/cloudscheduler/job/zz_controller.go +++ b/internal/controller/cloudscheduler/job/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudscheduler/v1beta1" @@ -49,14 +49,18 @@ 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.Job_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_scheduler_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_scheduler_job"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Job_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/cloudtasks/queue/zz_controller.go b/internal/controller/cloudtasks/queue/zz_controller.go index 6636d2930..34735ce77 100755 --- a/internal/controller/cloudtasks/queue/zz_controller.go +++ b/internal/controller/cloudtasks/queue/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/cloudtasks/v1beta1" @@ -49,14 +49,18 @@ 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.Queue_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Queue_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_cloud_tasks_queue"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_cloud_tasks_queue"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Queue_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/composer/environment/zz_controller.go b/internal/controller/composer/environment/zz_controller.go index cc7d6665e..705810317 100755 --- a/internal/controller/composer/environment/zz_controller.go +++ b/internal/controller/composer/environment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/composer/v1beta1" @@ -49,14 +49,18 @@ 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)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_composer_environment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_composer_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.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/address/zz_controller.go b/internal/controller/compute/address/zz_controller.go index 27dc57148..56cca2483 100755 --- a/internal/controller/compute/address/zz_controller.go +++ b/internal/controller/compute/address/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Address_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Address_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Address_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_address"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_address"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Address_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/attacheddisk/zz_controller.go b/internal/controller/compute/attacheddisk/zz_controller.go index ca3ef7bbd..8787cb0e5 100755 --- a/internal/controller/compute/attacheddisk/zz_controller.go +++ b/internal/controller/compute/attacheddisk/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.AttachedDisk_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AttachedDisk_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AttachedDisk_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_attached_disk"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_attached_disk"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AttachedDisk_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/autoscaler/zz_controller.go b/internal/controller/compute/autoscaler/zz_controller.go index dce4b2628..41b86a849 100755 --- a/internal/controller/compute/autoscaler/zz_controller.go +++ b/internal/controller/compute/autoscaler/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Autoscaler_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Autoscaler_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Autoscaler_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_autoscaler"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_autoscaler"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Autoscaler_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/backendbucket/zz_controller.go b/internal/controller/compute/backendbucket/zz_controller.go index 581159e04..6e686a3f0 100755 --- a/internal/controller/compute/backendbucket/zz_controller.go +++ b/internal/controller/compute/backendbucket/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.BackendBucket_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendBucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendBucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_bucket"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_backend_bucket"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendBucket_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go b/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go index d538e94b8..ed16c3106 100755 --- a/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go +++ b/internal/controller/compute/backendbucketsignedurlkey/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.BackendBucketSignedURLKey_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendBucketSignedURLKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendBucketSignedURLKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_bucket_signed_url_key"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_backend_bucket_signed_url_key"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendBucketSignedURLKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/backendservice/zz_controller.go b/internal/controller/compute/backendservice/zz_controller.go index fdbeccf13..b8f38da06 100755 --- a/internal/controller/compute/backendservice/zz_controller.go +++ b/internal/controller/compute/backendservice/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.BackendService_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_backend_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/backendservicesignedurlkey/zz_controller.go b/internal/controller/compute/backendservicesignedurlkey/zz_controller.go index 322467cc1..cf06f446a 100755 --- a/internal/controller/compute/backendservicesignedurlkey/zz_controller.go +++ b/internal/controller/compute/backendservicesignedurlkey/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.BackendServiceSignedURLKey_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendServiceSignedURLKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackendServiceSignedURLKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_backend_service_signed_url_key"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_backend_service_signed_url_key"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackendServiceSignedURLKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/disk/zz_controller.go b/internal/controller/compute/disk/zz_controller.go index 5fb18c0a2..bcbdb4779 100755 --- a/internal/controller/compute/disk/zz_controller.go +++ b/internal/controller/compute/disk/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Disk_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Disk_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Disk_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_disk"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_disk"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Disk_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/diskiammember/zz_controller.go b/internal/controller/compute/diskiammember/zz_controller.go index 52e865015..7bf2bf1c7 100755 --- a/internal/controller/compute/diskiammember/zz_controller.go +++ b/internal/controller/compute/diskiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.DiskIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DiskIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DiskIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_disk_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_disk_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DiskIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go b/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go index a3297bf83..d6ee8cbdb 100755 --- a/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go +++ b/internal/controller/compute/diskresourcepolicyattachment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.DiskResourcePolicyAttachment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DiskResourcePolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DiskResourcePolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_disk_resource_policy_attachment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_disk_resource_policy_attachment"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DiskResourcePolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/externalvpngateway/zz_controller.go b/internal/controller/compute/externalvpngateway/zz_controller.go index fcda05890..673b2beb6 100755 --- a/internal/controller/compute/externalvpngateway/zz_controller.go +++ b/internal/controller/compute/externalvpngateway/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.ExternalVPNGateway_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ExternalVPNGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ExternalVPNGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_external_vpn_gateway"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_external_vpn_gateway"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ExternalVPNGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/firewall/zz_controller.go b/internal/controller/compute/firewall/zz_controller.go index a0b28faa3..736ea668e 100755 --- a/internal/controller/compute/firewall/zz_controller.go +++ b/internal/controller/compute/firewall/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Firewall_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Firewall_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Firewall_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_firewall"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Firewall_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/firewallpolicy/zz_controller.go b/internal/controller/compute/firewallpolicy/zz_controller.go index fcfdc40d6..0484b28ce 100755 --- a/internal/controller/compute/firewallpolicy/zz_controller.go +++ b/internal/controller/compute/firewallpolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.FirewallPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FirewallPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/firewallpolicyassociation/zz_controller.go b/internal/controller/compute/firewallpolicyassociation/zz_controller.go index 659dd7ae5..98fa8c8f3 100755 --- a/internal/controller/compute/firewallpolicyassociation/zz_controller.go +++ b/internal/controller/compute/firewallpolicyassociation/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.FirewallPolicyAssociation_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicyAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicyAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy_association"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy_association"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FirewallPolicyAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/firewallpolicyrule/zz_controller.go b/internal/controller/compute/firewallpolicyrule/zz_controller.go index 9bb4dc88e..abd2eb509 100755 --- a/internal/controller/compute/firewallpolicyrule/zz_controller.go +++ b/internal/controller/compute/firewallpolicyrule/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.FirewallPolicyRule_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicyRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FirewallPolicyRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy_rule"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_firewall_policy_rule"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FirewallPolicyRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/forwardingrule/zz_controller.go b/internal/controller/compute/forwardingrule/zz_controller.go index acdfb34a9..81b105640 100755 --- a/internal/controller/compute/forwardingrule/zz_controller.go +++ b/internal/controller/compute/forwardingrule/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.ForwardingRule_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ForwardingRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ForwardingRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_forwarding_rule"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_forwarding_rule"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ForwardingRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/globaladdress/zz_controller.go b/internal/controller/compute/globaladdress/zz_controller.go index 3cb0ae7cc..d7ca8a5dc 100755 --- a/internal/controller/compute/globaladdress/zz_controller.go +++ b/internal/controller/compute/globaladdress/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.GlobalAddress_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalAddress_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalAddress_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_address"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_global_address"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalAddress_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/globalforwardingrule/zz_controller.go b/internal/controller/compute/globalforwardingrule/zz_controller.go index 05b4e58b1..6b7a56668 100755 --- a/internal/controller/compute/globalforwardingrule/zz_controller.go +++ b/internal/controller/compute/globalforwardingrule/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.GlobalForwardingRule_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalForwardingRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalForwardingRule_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_forwarding_rule"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_global_forwarding_rule"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalForwardingRule_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/globalnetworkendpoint/zz_controller.go b/internal/controller/compute/globalnetworkendpoint/zz_controller.go index 7fcdcd585..c9652701a 100755 --- a/internal/controller/compute/globalnetworkendpoint/zz_controller.go +++ b/internal/controller/compute/globalnetworkendpoint/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.GlobalNetworkEndpoint_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalNetworkEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalNetworkEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_network_endpoint"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_global_network_endpoint"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalNetworkEndpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go b/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go index cf1092529..50acdb60b 100755 --- a/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go +++ b/internal/controller/compute/globalnetworkendpointgroup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.GlobalNetworkEndpointGroup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalNetworkEndpointGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GlobalNetworkEndpointGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_global_network_endpoint_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_global_network_endpoint_group"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GlobalNetworkEndpointGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/havpngateway/zz_controller.go b/internal/controller/compute/havpngateway/zz_controller.go index e07a0a111..b995b3f08 100755 --- a/internal/controller/compute/havpngateway/zz_controller.go +++ b/internal/controller/compute/havpngateway/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.HaVPNGateway_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HaVPNGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HaVPNGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_ha_vpn_gateway"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_ha_vpn_gateway"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HaVPNGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/healthcheck/zz_controller.go b/internal/controller/compute/healthcheck/zz_controller.go index d33f341ee..d3ed8eee2 100755 --- a/internal/controller/compute/healthcheck/zz_controller.go +++ b/internal/controller/compute/healthcheck/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.HealthCheck_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_health_check"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_health_check"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HealthCheck_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/httphealthcheck/zz_controller.go b/internal/controller/compute/httphealthcheck/zz_controller.go index 536a72cf7..f97c92265 100755 --- a/internal/controller/compute/httphealthcheck/zz_controller.go +++ b/internal/controller/compute/httphealthcheck/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.HTTPHealthCheck_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HTTPHealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HTTPHealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_http_health_check"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_http_health_check"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HTTPHealthCheck_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/httpshealthcheck/zz_controller.go b/internal/controller/compute/httpshealthcheck/zz_controller.go index 9a6ff3ae8..45e675d7e 100755 --- a/internal/controller/compute/httpshealthcheck/zz_controller.go +++ b/internal/controller/compute/httpshealthcheck/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.HTTPSHealthCheck_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HTTPSHealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.HTTPSHealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_https_health_check"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_https_health_check"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.HTTPSHealthCheck_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/image/zz_controller.go b/internal/controller/compute/image/zz_controller.go index 3484b4bfe..0a337372a 100755 --- a/internal/controller/compute/image/zz_controller.go +++ b/internal/controller/compute/image/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Image_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Image_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Image_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_image"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_image"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Image_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/imageiammember/zz_controller.go b/internal/controller/compute/imageiammember/zz_controller.go index b1afcd4af..838eb8bec 100755 --- a/internal/controller/compute/imageiammember/zz_controller.go +++ b/internal/controller/compute/imageiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.ImageIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ImageIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ImageIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_image_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_image_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ImageIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/instance/zz_controller.go b/internal/controller/compute/instance/zz_controller.go index def574b29..5e2977de5 100755 --- a/internal/controller/compute/instance/zz_controller.go +++ b/internal/controller/compute/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/instancefromtemplate/zz_controller.go b/internal/controller/compute/instancefromtemplate/zz_controller.go index d30382e23..bd2bfc3a5 100755 --- a/internal/controller/compute/instancefromtemplate/zz_controller.go +++ b/internal/controller/compute/instancefromtemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.InstanceFromTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceFromTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceFromTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_from_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_instance_from_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceFromTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/instancegroup/zz_controller.go b/internal/controller/compute/instancegroup/zz_controller.go index a36c65db6..e1b3b6a50 100755 --- a/internal/controller/compute/instancegroup/zz_controller.go +++ b/internal/controller/compute/instancegroup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.InstanceGroup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/instancegroupmanager/zz_controller.go b/internal/controller/compute/instancegroupmanager/zz_controller.go index df57aaea4..9a48e29be 100755 --- a/internal/controller/compute/instancegroupmanager/zz_controller.go +++ b/internal/controller/compute/instancegroupmanager/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.InstanceGroupManager_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceGroupManager_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceGroupManager_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group_manager"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group_manager"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceGroupManager_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/instancegroupnamedport/zz_controller.go b/internal/controller/compute/instancegroupnamedport/zz_controller.go index 85fa977d7..2c91b7f3f 100755 --- a/internal/controller/compute/instancegroupnamedport/zz_controller.go +++ b/internal/controller/compute/instancegroupnamedport/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.InstanceGroupNamedPort_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceGroupNamedPort_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceGroupNamedPort_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group_named_port"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_instance_group_named_port"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceGroupNamedPort_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/instanceiammember/zz_controller.go b/internal/controller/compute/instanceiammember/zz_controller.go index b5c7ec053..586ab0f44 100755 --- a/internal/controller/compute/instanceiammember/zz_controller.go +++ b/internal/controller/compute/instanceiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.InstanceIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_instance_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/instancetemplate/zz_controller.go b/internal/controller/compute/instancetemplate/zz_controller.go index 806052d8b..683a7da71 100755 --- a/internal/controller/compute/instancetemplate/zz_controller.go +++ b/internal/controller/compute/instancetemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.InstanceTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_instance_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_instance_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/interconnectattachment/zz_controller.go b/internal/controller/compute/interconnectattachment/zz_controller.go index 70a32c20f..7d8ce33ed 100755 --- a/internal/controller/compute/interconnectattachment/zz_controller.go +++ b/internal/controller/compute/interconnectattachment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.InterconnectAttachment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InterconnectAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InterconnectAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_interconnect_attachment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_interconnect_attachment"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InterconnectAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/managedsslcertificate/zz_controller.go b/internal/controller/compute/managedsslcertificate/zz_controller.go index 8660088a0..f2bcbf107 100755 --- a/internal/controller/compute/managedsslcertificate/zz_controller.go +++ b/internal/controller/compute/managedsslcertificate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.ManagedSSLCertificate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedSSLCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedSSLCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_managed_ssl_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_managed_ssl_certificate"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedSSLCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/network/zz_controller.go b/internal/controller/compute/network/zz_controller.go index cfa5747d8..541ababf9 100755 --- a/internal/controller/compute/network/zz_controller.go +++ b/internal/controller/compute/network/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Network_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Network_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Network_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_network"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Network_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/networkendpoint/zz_controller.go b/internal/controller/compute/networkendpoint/zz_controller.go index 310a51f33..387564b0c 100755 --- a/internal/controller/compute/networkendpoint/zz_controller.go +++ b/internal/controller/compute/networkendpoint/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.NetworkEndpoint_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkEndpoint_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_endpoint"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_network_endpoint"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkEndpoint_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/networkendpointgroup/zz_controller.go b/internal/controller/compute/networkendpointgroup/zz_controller.go index 898cdfee9..0c460ff4d 100755 --- a/internal/controller/compute/networkendpointgroup/zz_controller.go +++ b/internal/controller/compute/networkendpointgroup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.NetworkEndpointGroup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkEndpointGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkEndpointGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_endpoint_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_network_endpoint_group"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkEndpointGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/networkfirewallpolicy/zz_controller.go b/internal/controller/compute/networkfirewallpolicy/zz_controller.go index 01f62049f..a68ad2bee 100755 --- a/internal/controller/compute/networkfirewallpolicy/zz_controller.go +++ b/internal/controller/compute/networkfirewallpolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.NetworkFirewallPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkFirewallPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkFirewallPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_firewall_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_network_firewall_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkFirewallPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go b/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go index 5debe0139..cee032ba1 100755 --- a/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go +++ b/internal/controller/compute/networkfirewallpolicyassociation/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.NetworkFirewallPolicyAssociation_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkFirewallPolicyAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkFirewallPolicyAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_firewall_policy_association"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_network_firewall_policy_association"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkFirewallPolicyAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/networkpeering/zz_controller.go b/internal/controller/compute/networkpeering/zz_controller.go index b7f4c594f..b26087654 100755 --- a/internal/controller/compute/networkpeering/zz_controller.go +++ b/internal/controller/compute/networkpeering/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.NetworkPeering_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkPeering_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkPeering_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_peering"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_network_peering"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkPeering_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go b/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go index 4734e5691..4ac03d106 100755 --- a/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go +++ b/internal/controller/compute/networkpeeringroutesconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.NetworkPeeringRoutesConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkPeeringRoutesConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NetworkPeeringRoutesConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_network_peering_routes_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_network_peering_routes_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NetworkPeeringRoutesConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/nodegroup/zz_controller.go b/internal/controller/compute/nodegroup/zz_controller.go index ea71ffa3b..4ae06433c 100755 --- a/internal/controller/compute/nodegroup/zz_controller.go +++ b/internal/controller/compute/nodegroup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.NodeGroup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodeGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodeGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_node_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_node_group"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodeGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/nodetemplate/zz_controller.go b/internal/controller/compute/nodetemplate/zz_controller.go index 08ea8a91d..ec8a5a4cb 100755 --- a/internal/controller/compute/nodetemplate/zz_controller.go +++ b/internal/controller/compute/nodetemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.NodeTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodeTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodeTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_node_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_node_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodeTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/packetmirroring/zz_controller.go b/internal/controller/compute/packetmirroring/zz_controller.go index ac38f2ed1..54ac577a9 100755 --- a/internal/controller/compute/packetmirroring/zz_controller.go +++ b/internal/controller/compute/packetmirroring/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.PacketMirroring_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PacketMirroring_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PacketMirroring_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_packet_mirroring"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_packet_mirroring"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PacketMirroring_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/perinstanceconfig/zz_controller.go b/internal/controller/compute/perinstanceconfig/zz_controller.go index 95b7b3923..bb96b1c3a 100755 --- a/internal/controller/compute/perinstanceconfig/zz_controller.go +++ b/internal/controller/compute/perinstanceconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.PerInstanceConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PerInstanceConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PerInstanceConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_per_instance_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_per_instance_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PerInstanceConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/projectdefaultnetworktier/zz_controller.go b/internal/controller/compute/projectdefaultnetworktier/zz_controller.go index 70109b1b0..cbb0eea9c 100755 --- a/internal/controller/compute/projectdefaultnetworktier/zz_controller.go +++ b/internal/controller/compute/projectdefaultnetworktier/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectDefaultNetworkTier_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectDefaultNetworkTier_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectDefaultNetworkTier_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_project_default_network_tier"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_project_default_network_tier"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectDefaultNetworkTier_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/projectmetadata/zz_controller.go b/internal/controller/compute/projectmetadata/zz_controller.go index 8a9591d44..81d5fb5df 100755 --- a/internal/controller/compute/projectmetadata/zz_controller.go +++ b/internal/controller/compute/projectmetadata/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectMetadata_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectMetadata_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectMetadata_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_project_metadata"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_project_metadata"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectMetadata_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/projectmetadataitem/zz_controller.go b/internal/controller/compute/projectmetadataitem/zz_controller.go index 8cd7de82a..d06de18f2 100755 --- a/internal/controller/compute/projectmetadataitem/zz_controller.go +++ b/internal/controller/compute/projectmetadataitem/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectMetadataItem_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectMetadataItem_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectMetadataItem_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_project_metadata_item"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_project_metadata_item"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectMetadataItem_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionautoscaler/zz_controller.go b/internal/controller/compute/regionautoscaler/zz_controller.go index 0adba0ea8..89fdfec30 100755 --- a/internal/controller/compute/regionautoscaler/zz_controller.go +++ b/internal/controller/compute/regionautoscaler/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionAutoscaler_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionAutoscaler_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionAutoscaler_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_autoscaler"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_autoscaler"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionAutoscaler_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionbackendservice/zz_controller.go b/internal/controller/compute/regionbackendservice/zz_controller.go index fa9e32720..1882f9d56 100755 --- a/internal/controller/compute/regionbackendservice/zz_controller.go +++ b/internal/controller/compute/regionbackendservice/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionBackendService_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionBackendService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionBackendService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_backend_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_backend_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionBackendService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regiondisk/zz_controller.go b/internal/controller/compute/regiondisk/zz_controller.go index 27fff3bca..6c49331ee 100755 --- a/internal/controller/compute/regiondisk/zz_controller.go +++ b/internal/controller/compute/regiondisk/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionDisk_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionDisk_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionDisk_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionDisk_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regiondiskiammember/zz_controller.go b/internal/controller/compute/regiondiskiammember/zz_controller.go index 1df542ff8..76a5a12ec 100755 --- a/internal/controller/compute/regiondiskiammember/zz_controller.go +++ b/internal/controller/compute/regiondiskiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.RegionDiskIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionDiskIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionDiskIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionDiskIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go b/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go index 47f5a82ed..d146bf33f 100755 --- a/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go +++ b/internal/controller/compute/regiondiskresourcepolicyattachment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.RegionDiskResourcePolicyAttachment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionDiskResourcePolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionDiskResourcePolicyAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk_resource_policy_attachment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_disk_resource_policy_attachment"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionDiskResourcePolicyAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionhealthcheck/zz_controller.go b/internal/controller/compute/regionhealthcheck/zz_controller.go index 218fe4766..ef4e43080 100755 --- a/internal/controller/compute/regionhealthcheck/zz_controller.go +++ b/internal/controller/compute/regionhealthcheck/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionHealthCheck_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionHealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionHealthCheck_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_health_check"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_health_check"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionHealthCheck_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regioninstancegroupmanager/zz_controller.go b/internal/controller/compute/regioninstancegroupmanager/zz_controller.go index 8c2e01f0a..5824a8cbe 100755 --- a/internal/controller/compute/regioninstancegroupmanager/zz_controller.go +++ b/internal/controller/compute/regioninstancegroupmanager/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.RegionInstanceGroupManager_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionInstanceGroupManager_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionInstanceGroupManager_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_instance_group_manager"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_instance_group_manager"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionInstanceGroupManager_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go b/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go index 894ebb7e0..44d632fb1 100755 --- a/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go +++ b/internal/controller/compute/regionnetworkendpointgroup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionNetworkEndpointGroup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionNetworkEndpointGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionNetworkEndpointGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_endpoint_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_endpoint_group"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionNetworkEndpointGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go b/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go index 145b28502..44fe548c4 100755 --- a/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go +++ b/internal/controller/compute/regionnetworkfirewallpolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionNetworkFirewallPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionNetworkFirewallPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionNetworkFirewallPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_firewall_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_firewall_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionNetworkFirewallPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go b/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go index e4b3d9fa2..42685854f 100755 --- a/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go +++ b/internal/controller/compute/regionnetworkfirewallpolicyassociation/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionNetworkFirewallPolicyAssociation_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionNetworkFirewallPolicyAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionNetworkFirewallPolicyAssociation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_firewall_policy_association"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_network_firewall_policy_association"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionNetworkFirewallPolicyAssociation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionperinstanceconfig/zz_controller.go b/internal/controller/compute/regionperinstanceconfig/zz_controller.go index a9536326e..006057cda 100755 --- a/internal/controller/compute/regionperinstanceconfig/zz_controller.go +++ b/internal/controller/compute/regionperinstanceconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.RegionPerInstanceConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionPerInstanceConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionPerInstanceConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_per_instance_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_per_instance_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionPerInstanceConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionsslcertificate/zz_controller.go b/internal/controller/compute/regionsslcertificate/zz_controller.go index 566e894bd..9f709977c 100755 --- a/internal/controller/compute/regionsslcertificate/zz_controller.go +++ b/internal/controller/compute/regionsslcertificate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionSSLCertificate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionSSLCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionSSLCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_ssl_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_ssl_certificate"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionSSLCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regiontargethttpproxy/zz_controller.go b/internal/controller/compute/regiontargethttpproxy/zz_controller.go index 8f2b1ec72..86486abc8 100755 --- a/internal/controller/compute/regiontargethttpproxy/zz_controller.go +++ b/internal/controller/compute/regiontargethttpproxy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionTargetHTTPProxy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionTargetHTTPProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionTargetHTTPProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_target_http_proxy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_target_http_proxy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionTargetHTTPProxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regiontargethttpsproxy/zz_controller.go b/internal/controller/compute/regiontargethttpsproxy/zz_controller.go index 41fa72b00..ce5e3cc99 100755 --- a/internal/controller/compute/regiontargethttpsproxy/zz_controller.go +++ b/internal/controller/compute/regiontargethttpsproxy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionTargetHTTPSProxy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionTargetHTTPSProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionTargetHTTPSProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_target_https_proxy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_target_https_proxy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionTargetHTTPSProxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/regionurlmap/zz_controller.go b/internal/controller/compute/regionurlmap/zz_controller.go index f185fd9df..2e462d040 100755 --- a/internal/controller/compute/regionurlmap/zz_controller.go +++ b/internal/controller/compute/regionurlmap/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RegionURLMap_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionURLMap_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RegionURLMap_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_region_url_map"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_region_url_map"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RegionURLMap_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/reservation/zz_controller.go b/internal/controller/compute/reservation/zz_controller.go index d8c17b64a..cd00b07c3 100755 --- a/internal/controller/compute/reservation/zz_controller.go +++ b/internal/controller/compute/reservation/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Reservation_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Reservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Reservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_reservation"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_reservation"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Reservation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/resourcepolicy/zz_controller.go b/internal/controller/compute/resourcepolicy/zz_controller.go index f3288425d..493419008 100755 --- a/internal/controller/compute/resourcepolicy/zz_controller.go +++ b/internal/controller/compute/resourcepolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.ResourcePolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ResourcePolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_resource_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_resource_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ResourcePolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/route/zz_controller.go b/internal/controller/compute/route/zz_controller.go index cee852718..ff413c2cf 100755 --- a/internal/controller/compute/route/zz_controller.go +++ b/internal/controller/compute/route/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Route_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Route_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_route"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_route"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Route_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/router/zz_controller.go b/internal/controller/compute/router/zz_controller.go index d39c27221..4432bd7f5 100755 --- a/internal/controller/compute/router/zz_controller.go +++ b/internal/controller/compute/router/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Router_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Router_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Router_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_router"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_router"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Router_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/routerinterface/zz_controller.go b/internal/controller/compute/routerinterface/zz_controller.go index 614b506e9..a9bd2fba1 100755 --- a/internal/controller/compute/routerinterface/zz_controller.go +++ b/internal/controller/compute/routerinterface/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.RouterInterface_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouterInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouterInterface_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_router_interface"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_router_interface"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouterInterface_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/routernat/zz_controller.go b/internal/controller/compute/routernat/zz_controller.go index 5677edf37..4e7164d47 100755 --- a/internal/controller/compute/routernat/zz_controller.go +++ b/internal/controller/compute/routernat/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RouterNAT_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouterNAT_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouterNAT_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_router_nat"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_router_nat"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouterNAT_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/routerpeer/zz_controller.go b/internal/controller/compute/routerpeer/zz_controller.go index c5b0d3d15..4effa754b 100755 --- a/internal/controller/compute/routerpeer/zz_controller.go +++ b/internal/controller/compute/routerpeer/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.RouterPeer_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouterPeer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RouterPeer_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_router_peer"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_router_peer"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RouterPeer_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/securitypolicy/zz_controller.go b/internal/controller/compute/securitypolicy/zz_controller.go index c8a2de73f..2fdcb55de 100755 --- a/internal/controller/compute/securitypolicy/zz_controller.go +++ b/internal/controller/compute/securitypolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.SecurityPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecurityPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecurityPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_security_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_security_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecurityPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/serviceattachment/zz_controller.go b/internal/controller/compute/serviceattachment/zz_controller.go index 75c3e2de6..61c5ba18a 100755 --- a/internal/controller/compute/serviceattachment/zz_controller.go +++ b/internal/controller/compute/serviceattachment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.ServiceAttachment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServiceAttachment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_service_attachment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_service_attachment"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServiceAttachment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/sharedvpchostproject/zz_controller.go b/internal/controller/compute/sharedvpchostproject/zz_controller.go index a6b04b3e6..92ce02da1 100755 --- a/internal/controller/compute/sharedvpchostproject/zz_controller.go +++ b/internal/controller/compute/sharedvpchostproject/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.SharedVPCHostProject_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SharedVPCHostProject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SharedVPCHostProject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_shared_vpc_host_project"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_shared_vpc_host_project"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SharedVPCHostProject_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/sharedvpcserviceproject/zz_controller.go b/internal/controller/compute/sharedvpcserviceproject/zz_controller.go index 49d214a5b..9d03e8ba7 100755 --- a/internal/controller/compute/sharedvpcserviceproject/zz_controller.go +++ b/internal/controller/compute/sharedvpcserviceproject/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.SharedVPCServiceProject_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SharedVPCServiceProject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SharedVPCServiceProject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_shared_vpc_service_project"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_shared_vpc_service_project"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SharedVPCServiceProject_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/snapshot/zz_controller.go b/internal/controller/compute/snapshot/zz_controller.go index bfe4d88f9..c036e3ae8 100755 --- a/internal/controller/compute/snapshot/zz_controller.go +++ b/internal/controller/compute/snapshot/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Snapshot_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_snapshot"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_snapshot"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/snapshotiammember/zz_controller.go b/internal/controller/compute/snapshotiammember/zz_controller.go index a4f7cfa01..a04688e3e 100755 --- a/internal/controller/compute/snapshotiammember/zz_controller.go +++ b/internal/controller/compute/snapshotiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.SnapshotIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SnapshotIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SnapshotIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_snapshot_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_snapshot_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SnapshotIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/sslcertificate/zz_controller.go b/internal/controller/compute/sslcertificate/zz_controller.go index f6eafe2de..bd33014f5 100755 --- a/internal/controller/compute/sslcertificate/zz_controller.go +++ b/internal/controller/compute/sslcertificate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.SSLCertificate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSLCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSLCertificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_ssl_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_ssl_certificate"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SSLCertificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/sslpolicy/zz_controller.go b/internal/controller/compute/sslpolicy/zz_controller.go index 7687f025c..bb9294cea 100755 --- a/internal/controller/compute/sslpolicy/zz_controller.go +++ b/internal/controller/compute/sslpolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.SSLPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSLPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSLPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_ssl_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_ssl_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SSLPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/subnetwork/zz_controller.go b/internal/controller/compute/subnetwork/zz_controller.go index bd1186695..4c2f88474 100755 --- a/internal/controller/compute/subnetwork/zz_controller.go +++ b/internal/controller/compute/subnetwork/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.Subnetwork_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Subnetwork_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Subnetwork_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_subnetwork"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_subnetwork"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Subnetwork_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/subnetworkiammember/zz_controller.go b/internal/controller/compute/subnetworkiammember/zz_controller.go index 67d2bd8b1..8f7512436 100755 --- a/internal/controller/compute/subnetworkiammember/zz_controller.go +++ b/internal/controller/compute/subnetworkiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -48,14 +48,18 @@ 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.SubnetworkIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetworkIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubnetworkIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_subnetwork_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_subnetwork_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubnetworkIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/targetgrpcproxy/zz_controller.go b/internal/controller/compute/targetgrpcproxy/zz_controller.go index e4eff4503..85c4c7972 100755 --- a/internal/controller/compute/targetgrpcproxy/zz_controller.go +++ b/internal/controller/compute/targetgrpcproxy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.TargetGRPCProxy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetGRPCProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetGRPCProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_grpc_proxy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_target_grpc_proxy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TargetGRPCProxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/targethttpproxy/zz_controller.go b/internal/controller/compute/targethttpproxy/zz_controller.go index a5f14376a..4091ecd82 100755 --- a/internal/controller/compute/targethttpproxy/zz_controller.go +++ b/internal/controller/compute/targethttpproxy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.TargetHTTPProxy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetHTTPProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetHTTPProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_http_proxy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_target_http_proxy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TargetHTTPProxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/targethttpsproxy/zz_controller.go b/internal/controller/compute/targethttpsproxy/zz_controller.go index 96992fb27..1b8de7f3d 100755 --- a/internal/controller/compute/targethttpsproxy/zz_controller.go +++ b/internal/controller/compute/targethttpsproxy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.TargetHTTPSProxy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetHTTPSProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetHTTPSProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_https_proxy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_target_https_proxy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TargetHTTPSProxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/targetinstance/zz_controller.go b/internal/controller/compute/targetinstance/zz_controller.go index 11faca5bb..c24788d49 100755 --- a/internal/controller/compute/targetinstance/zz_controller.go +++ b/internal/controller/compute/targetinstance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.TargetInstance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_target_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TargetInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/targetpool/zz_controller.go b/internal/controller/compute/targetpool/zz_controller.go index d6af9cb84..0c72f2f4d 100755 --- a/internal/controller/compute/targetpool/zz_controller.go +++ b/internal/controller/compute/targetpool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.TargetPool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_target_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TargetPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/targetsslproxy/zz_controller.go b/internal/controller/compute/targetsslproxy/zz_controller.go index 5c9b1d1c3..2d7198ff5 100755 --- a/internal/controller/compute/targetsslproxy/zz_controller.go +++ b/internal/controller/compute/targetsslproxy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.TargetSSLProxy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetSSLProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetSSLProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_ssl_proxy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_target_ssl_proxy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TargetSSLProxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/targettcpproxy/zz_controller.go b/internal/controller/compute/targettcpproxy/zz_controller.go index 574d20302..0028f7b22 100755 --- a/internal/controller/compute/targettcpproxy/zz_controller.go +++ b/internal/controller/compute/targettcpproxy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.TargetTCPProxy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetTCPProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TargetTCPProxy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_target_tcp_proxy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_target_tcp_proxy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TargetTCPProxy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/urlmap/zz_controller.go b/internal/controller/compute/urlmap/zz_controller.go index 76e068879..77489c172 100755 --- a/internal/controller/compute/urlmap/zz_controller.go +++ b/internal/controller/compute/urlmap/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.URLMap_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.URLMap_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.URLMap_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_url_map"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_url_map"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.URLMap_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/vpngateway/zz_controller.go b/internal/controller/compute/vpngateway/zz_controller.go index 0acab2d08..d8f019c73 100755 --- a/internal/controller/compute/vpngateway/zz_controller.go +++ b/internal/controller/compute/vpngateway/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.VPNGateway_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNGateway_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_vpn_gateway"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_vpn_gateway"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNGateway_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/compute/vpntunnel/zz_controller.go b/internal/controller/compute/vpntunnel/zz_controller.go index 7faef6d3f..b8d77b2b4 100755 --- a/internal/controller/compute/vpntunnel/zz_controller.go +++ b/internal/controller/compute/vpntunnel/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/compute/v1beta1" @@ -49,14 +49,18 @@ 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.VPNTunnel_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNTunnel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.VPNTunnel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_compute_vpn_tunnel"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_compute_vpn_tunnel"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.VPNTunnel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/container/cluster/zz_controller.go b/internal/controller/container/cluster/zz_controller.go index 0e5fb4bda..4501c86ce 100755 --- a/internal/controller/container/cluster/zz_controller.go +++ b/internal/controller/container/cluster/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/container/v1beta1" @@ -49,14 +49,18 @@ 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.Cluster_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_cluster"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_cluster"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/container/nodepool/zz_controller.go b/internal/controller/container/nodepool/zz_controller.go index 7bfe9909b..9d49adf66 100755 --- a/internal/controller/container/nodepool/zz_controller.go +++ b/internal/controller/container/nodepool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/container/v1beta1" @@ -49,14 +49,18 @@ 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.NodePool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodePool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodePool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_node_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_node_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodePool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/container/registry/zz_controller.go b/internal/controller/container/registry/zz_controller.go index 8b17eb8f5..d1eb456ec 100755 --- a/internal/controller/container/registry/zz_controller.go +++ b/internal/controller/container/registry/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/container/v1beta1" @@ -48,14 +48,18 @@ 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.Registry_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Registry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_registry"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_registry"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Registry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/containeranalysis/note/zz_controller.go b/internal/controller/containeranalysis/note/zz_controller.go index 0074cbc92..722bc2144 100755 --- a/internal/controller/containeranalysis/note/zz_controller.go +++ b/internal/controller/containeranalysis/note/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/containeranalysis/v1beta1" @@ -49,14 +49,18 @@ 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.Note_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Note_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Note_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_analysis_note"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_analysis_note"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Note_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/containeraws/cluster/zz_controller.go b/internal/controller/containeraws/cluster/zz_controller.go index 212b6727a..2248cfa5a 100755 --- a/internal/controller/containeraws/cluster/zz_controller.go +++ b/internal/controller/containeraws/cluster/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/containeraws/v1beta1" @@ -49,14 +49,18 @@ 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.Cluster_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_aws_cluster"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_aws_cluster"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/containeraws/nodepool/zz_controller.go b/internal/controller/containeraws/nodepool/zz_controller.go index 8254676c8..95d7a9d0b 100755 --- a/internal/controller/containeraws/nodepool/zz_controller.go +++ b/internal/controller/containeraws/nodepool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/containeraws/v1beta1" @@ -49,14 +49,18 @@ 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.NodePool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodePool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodePool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_aws_node_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_aws_node_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodePool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/containerazure/client/zz_controller.go b/internal/controller/containerazure/client/zz_controller.go index 462ad914d..82d412301 100755 --- a/internal/controller/containerazure/client/zz_controller.go +++ b/internal/controller/containerazure/client/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/containerazure/v1beta1" @@ -49,14 +49,18 @@ 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.Client_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Client_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Client_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_azure_client"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_azure_client"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Client_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/containerazure/cluster/zz_controller.go b/internal/controller/containerazure/cluster/zz_controller.go index 9cae79943..f80d12d79 100755 --- a/internal/controller/containerazure/cluster/zz_controller.go +++ b/internal/controller/containerazure/cluster/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/containerazure/v1beta1" @@ -49,14 +49,18 @@ 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.Cluster_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_azure_cluster"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_azure_cluster"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/containerazure/nodepool/zz_controller.go b/internal/controller/containerazure/nodepool/zz_controller.go index 0d4dfb4c2..7cfb2f946 100755 --- a/internal/controller/containerazure/nodepool/zz_controller.go +++ b/internal/controller/containerazure/nodepool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/containerazure/v1beta1" @@ -49,14 +49,18 @@ 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.NodePool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodePool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NodePool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_container_azure_node_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_container_azure_node_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NodePool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datacatalog/entry/zz_controller.go b/internal/controller/datacatalog/entry/zz_controller.go index 83dfbf18e..313569036 100755 --- a/internal/controller/datacatalog/entry/zz_controller.go +++ b/internal/controller/datacatalog/entry/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datacatalog/v1beta1" @@ -48,14 +48,18 @@ 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.Entry_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Entry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Entry_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_entry"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_catalog_entry"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Entry_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datacatalog/entrygroup/zz_controller.go b/internal/controller/datacatalog/entrygroup/zz_controller.go index 898e3745c..f0d048da2 100755 --- a/internal/controller/datacatalog/entrygroup/zz_controller.go +++ b/internal/controller/datacatalog/entrygroup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datacatalog/v1beta1" @@ -48,14 +48,18 @@ 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.EntryGroup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EntryGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EntryGroup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_entry_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_catalog_entry_group"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EntryGroup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datacatalog/tag/zz_controller.go b/internal/controller/datacatalog/tag/zz_controller.go index 4b1098ad6..82c1aa0ea 100755 --- a/internal/controller/datacatalog/tag/zz_controller.go +++ b/internal/controller/datacatalog/tag/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datacatalog/v1beta1" @@ -48,14 +48,18 @@ 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.Tag_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tag_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_tag"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_catalog_tag"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tag_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datacatalog/tagtemplate/zz_controller.go b/internal/controller/datacatalog/tagtemplate/zz_controller.go index c12aba71a..12465484b 100755 --- a/internal/controller/datacatalog/tagtemplate/zz_controller.go +++ b/internal/controller/datacatalog/tagtemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datacatalog/v1beta1" @@ -49,14 +49,18 @@ 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.TagTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TagTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TagTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_catalog_tag_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_catalog_tag_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataflow/job/zz_controller.go b/internal/controller/dataflow/job/zz_controller.go index 07a620d61..c4e79daa7 100755 --- a/internal/controller/dataflow/job/zz_controller.go +++ b/internal/controller/dataflow/job/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataflow/v1beta1" @@ -48,14 +48,18 @@ 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.Job_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataflow_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataflow_job"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Job_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datafusion/instance/zz_controller.go b/internal/controller/datafusion/instance/zz_controller.go index c436056ff..447c4364f 100755 --- a/internal/controller/datafusion/instance/zz_controller.go +++ b/internal/controller/datafusion/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datafusion/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_fusion_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_fusion_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go b/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go index be5f543a8..10cb0693b 100755 --- a/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go +++ b/internal/controller/datalossprevention/deidentifytemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datalossprevention/v1beta1" @@ -48,14 +48,18 @@ 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.DeidentifyTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeidentifyTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DeidentifyTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_deidentify_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_deidentify_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DeidentifyTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datalossprevention/inspecttemplate/zz_controller.go b/internal/controller/datalossprevention/inspecttemplate/zz_controller.go index 2544b03e5..4e9247d73 100755 --- a/internal/controller/datalossprevention/inspecttemplate/zz_controller.go +++ b/internal/controller/datalossprevention/inspecttemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datalossprevention/v1beta1" @@ -48,14 +48,18 @@ 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.InspectTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InspectTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InspectTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_inspect_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_inspect_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InspectTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datalossprevention/jobtrigger/zz_controller.go b/internal/controller/datalossprevention/jobtrigger/zz_controller.go index 91bdf6263..40535bf58 100755 --- a/internal/controller/datalossprevention/jobtrigger/zz_controller.go +++ b/internal/controller/datalossprevention/jobtrigger/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datalossprevention/v1beta1" @@ -48,14 +48,18 @@ 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.JobTrigger_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.JobTrigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.JobTrigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_job_trigger"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_job_trigger"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.JobTrigger_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datalossprevention/storedinfotype/zz_controller.go b/internal/controller/datalossprevention/storedinfotype/zz_controller.go index 2e504bcef..dd175b1b2 100755 --- a/internal/controller/datalossprevention/storedinfotype/zz_controller.go +++ b/internal/controller/datalossprevention/storedinfotype/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datalossprevention/v1beta1" @@ -48,14 +48,18 @@ 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.StoredInfoType_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StoredInfoType_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.StoredInfoType_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_stored_info_type"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_data_loss_prevention_stored_info_type"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.StoredInfoType_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataplex/asset/zz_controller.go b/internal/controller/dataplex/asset/zz_controller.go index 7c62b3ec5..d1a8d0252 100755 --- a/internal/controller/dataplex/asset/zz_controller.go +++ b/internal/controller/dataplex/asset/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataplex/v1beta1" @@ -49,14 +49,18 @@ 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.Asset_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Asset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Asset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataplex_asset"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataplex_asset"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Asset_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataplex/lake/zz_controller.go b/internal/controller/dataplex/lake/zz_controller.go index 545c1fcc9..ef1f8ce39 100755 --- a/internal/controller/dataplex/lake/zz_controller.go +++ b/internal/controller/dataplex/lake/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataplex/v1beta1" @@ -49,14 +49,18 @@ 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.Lake_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Lake_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Lake_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataplex_lake"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataplex_lake"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Lake_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataplex/zone/zz_controller.go b/internal/controller/dataplex/zone/zz_controller.go index e26c86d4e..f1cbb38a3 100755 --- a/internal/controller/dataplex/zone/zz_controller.go +++ b/internal/controller/dataplex/zone/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataplex/v1beta1" @@ -49,14 +49,18 @@ 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.Zone_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Zone_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Zone_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataplex_zone"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataplex_zone"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Zone_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataproc/autoscalingpolicy/zz_controller.go b/internal/controller/dataproc/autoscalingpolicy/zz_controller.go index 3c3f5d0cc..893bdbcd3 100755 --- a/internal/controller/dataproc/autoscalingpolicy/zz_controller.go +++ b/internal/controller/dataproc/autoscalingpolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataproc/v1beta1" @@ -49,14 +49,18 @@ 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.AutoscalingPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AutoscalingPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AutoscalingPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_autoscaling_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataproc_autoscaling_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AutoscalingPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataproc/cluster/zz_controller.go b/internal/controller/dataproc/cluster/zz_controller.go index 1d9d6cb44..5696b62c9 100755 --- a/internal/controller/dataproc/cluster/zz_controller.go +++ b/internal/controller/dataproc/cluster/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataproc/v1beta1" @@ -48,14 +48,18 @@ 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.Cluster_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Cluster_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_cluster"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataproc_cluster"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Cluster_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataproc/job/zz_controller.go b/internal/controller/dataproc/job/zz_controller.go index 3b622af88..85c93ed0c 100755 --- a/internal/controller/dataproc/job/zz_controller.go +++ b/internal/controller/dataproc/job/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataproc/v1beta1" @@ -48,14 +48,18 @@ 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.Job_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Job_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataproc_job"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Job_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataproc/metastoreservice/zz_controller.go b/internal/controller/dataproc/metastoreservice/zz_controller.go index 265a6a70a..214d5b96d 100755 --- a/internal/controller/dataproc/metastoreservice/zz_controller.go +++ b/internal/controller/dataproc/metastoreservice/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataproc/v1beta1" @@ -49,14 +49,18 @@ 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.MetastoreService_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetastoreService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetastoreService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_metastore_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataproc_metastore_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetastoreService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dataproc/workflowtemplate/zz_controller.go b/internal/controller/dataproc/workflowtemplate/zz_controller.go index 049fb66ac..0fa2fca0c 100755 --- a/internal/controller/dataproc/workflowtemplate/zz_controller.go +++ b/internal/controller/dataproc/workflowtemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dataproc/v1beta1" @@ -49,14 +49,18 @@ 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.WorkflowTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkflowTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkflowTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dataproc_workflow_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dataproc_workflow_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkflowTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datastore/index/zz_controller.go b/internal/controller/datastore/index/zz_controller.go index f68b184bd..b60a0a5cf 100755 --- a/internal/controller/datastore/index/zz_controller.go +++ b/internal/controller/datastore/index/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datastore/v1beta1" @@ -48,14 +48,18 @@ 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.Index_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Index_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Index_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_datastore_index"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_datastore_index"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Index_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datastream/connectionprofile/zz_controller.go b/internal/controller/datastream/connectionprofile/zz_controller.go index 63ea06b08..9d6cb1fc8 100755 --- a/internal/controller/datastream/connectionprofile/zz_controller.go +++ b/internal/controller/datastream/connectionprofile/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datastream/v1beta1" @@ -49,14 +49,18 @@ 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.ConnectionProfile_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConnectionProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConnectionProfile_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_datastream_connection_profile"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_datastream_connection_profile"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConnectionProfile_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/datastream/privateconnection/zz_controller.go b/internal/controller/datastream/privateconnection/zz_controller.go index 5c90e3bd8..f5f886bf4 100755 --- a/internal/controller/datastream/privateconnection/zz_controller.go +++ b/internal/controller/datastream/privateconnection/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/datastream/v1beta1" @@ -49,14 +49,18 @@ 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.PrivateConnection_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PrivateConnection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PrivateConnection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_datastream_private_connection"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_datastream_private_connection"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PrivateConnection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/agent/zz_controller.go b/internal/controller/dialogflowcx/agent/zz_controller.go index 2de090855..7ee3ad6c9 100755 --- a/internal/controller/dialogflowcx/agent/zz_controller.go +++ b/internal/controller/dialogflowcx/agent/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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.Agent_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Agent_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Agent_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_agent"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_agent"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Agent_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/entitytype/zz_controller.go b/internal/controller/dialogflowcx/entitytype/zz_controller.go index ec2a8cd7b..7720edfee 100755 --- a/internal/controller/dialogflowcx/entitytype/zz_controller.go +++ b/internal/controller/dialogflowcx/entitytype/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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.EntityType_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EntityType_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.EntityType_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_entity_type"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_entity_type"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.EntityType_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/environment/zz_controller.go b/internal/controller/dialogflowcx/environment/zz_controller.go index 9b7fa0327..c941629d5 100755 --- a/internal/controller/dialogflowcx/environment/zz_controller.go +++ b/internal/controller/dialogflowcx/environment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_environment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_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.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/flow/zz_controller.go b/internal/controller/dialogflowcx/flow/zz_controller.go index 5c05c454e..8ea03172f 100755 --- a/internal/controller/dialogflowcx/flow/zz_controller.go +++ b/internal/controller/dialogflowcx/flow/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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.Flow_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Flow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Flow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_flow"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_flow"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Flow_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/intent/zz_controller.go b/internal/controller/dialogflowcx/intent/zz_controller.go index f7d2cc952..5e1ebf9ad 100755 --- a/internal/controller/dialogflowcx/intent/zz_controller.go +++ b/internal/controller/dialogflowcx/intent/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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.Intent_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Intent_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Intent_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_intent"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_intent"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Intent_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/page/zz_controller.go b/internal/controller/dialogflowcx/page/zz_controller.go index b3960298b..0459c8536 100755 --- a/internal/controller/dialogflowcx/page/zz_controller.go +++ b/internal/controller/dialogflowcx/page/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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.Page_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Page_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Page_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_page"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_page"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Page_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/version/zz_controller.go b/internal/controller/dialogflowcx/version/zz_controller.go index 8fb347d7a..82fafd4f3 100755 --- a/internal/controller/dialogflowcx/version/zz_controller.go +++ b/internal/controller/dialogflowcx/version/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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.Version_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Version_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Version_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_version"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_version"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Version_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dialogflowcx/webhook/zz_controller.go b/internal/controller/dialogflowcx/webhook/zz_controller.go index 097f0ec66..7d2e5553b 100755 --- a/internal/controller/dialogflowcx/webhook/zz_controller.go +++ b/internal/controller/dialogflowcx/webhook/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dialogflowcx/v1beta1" @@ -48,14 +48,18 @@ 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.Webhook_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Webhook_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_webhook"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dialogflow_cx_webhook"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Webhook_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dns/managedzone/zz_controller.go b/internal/controller/dns/managedzone/zz_controller.go index 34a37e7fd..78f8604b8 100755 --- a/internal/controller/dns/managedzone/zz_controller.go +++ b/internal/controller/dns/managedzone/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dns/v1beta1" @@ -49,14 +49,18 @@ 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.ManagedZone_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedZone_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedZone_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_managed_zone"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dns_managed_zone"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedZone_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dns/managedzoneiammember/zz_controller.go b/internal/controller/dns/managedzoneiammember/zz_controller.go index 340a7b893..2c21a75d1 100755 --- a/internal/controller/dns/managedzoneiammember/zz_controller.go +++ b/internal/controller/dns/managedzoneiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dns/v1beta1" @@ -48,14 +48,18 @@ 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.ManagedZoneIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedZoneIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ManagedZoneIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_managed_zone_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dns_managed_zone_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ManagedZoneIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dns/policy/zz_controller.go b/internal/controller/dns/policy/zz_controller.go index 225758a98..1b2faf0ae 100755 --- a/internal/controller/dns/policy/zz_controller.go +++ b/internal/controller/dns/policy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dns/v1beta1" @@ -49,14 +49,18 @@ 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.Policy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Policy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dns_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Policy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/dns/recordset/zz_controller.go b/internal/controller/dns/recordset/zz_controller.go index 4a57e7467..ce8b3ea29 100755 --- a/internal/controller/dns/recordset/zz_controller.go +++ b/internal/controller/dns/recordset/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/dns/v1beta1" @@ -48,14 +48,18 @@ 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.RecordSet_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RecordSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RecordSet_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_dns_record_set"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_dns_record_set"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RecordSet_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/documentai/processor/zz_controller.go b/internal/controller/documentai/processor/zz_controller.go index 1f44f5b4e..b618c5aa7 100755 --- a/internal/controller/documentai/processor/zz_controller.go +++ b/internal/controller/documentai/processor/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/documentai/v1beta1" @@ -48,14 +48,18 @@ 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.Processor_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Processor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Processor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_document_ai_processor"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_document_ai_processor"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Processor_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/essentialcontacts/contact/zz_controller.go b/internal/controller/essentialcontacts/contact/zz_controller.go index 227616d95..8d276d890 100755 --- a/internal/controller/essentialcontacts/contact/zz_controller.go +++ b/internal/controller/essentialcontacts/contact/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/essentialcontacts/v1beta1" @@ -48,14 +48,18 @@ 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.Contact_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Contact_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Contact_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_essential_contacts_contact"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_essential_contacts_contact"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Contact_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/eventarc/channel/zz_controller.go b/internal/controller/eventarc/channel/zz_controller.go index dc86a6b8d..b3d4a7d48 100755 --- a/internal/controller/eventarc/channel/zz_controller.go +++ b/internal/controller/eventarc/channel/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/eventarc/v1beta1" @@ -49,14 +49,18 @@ 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.Channel_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Channel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_eventarc_channel"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_eventarc_channel"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Channel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/eventarc/googlechannelconfig/zz_controller.go b/internal/controller/eventarc/googlechannelconfig/zz_controller.go index 6b1a14a07..a4352b7a3 100755 --- a/internal/controller/eventarc/googlechannelconfig/zz_controller.go +++ b/internal/controller/eventarc/googlechannelconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/eventarc/v1beta1" @@ -49,14 +49,18 @@ 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.GoogleChannelConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GoogleChannelConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.GoogleChannelConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_eventarc_google_channel_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_eventarc_google_channel_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.GoogleChannelConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/eventarc/trigger/zz_controller.go b/internal/controller/eventarc/trigger/zz_controller.go index 4baf2af92..4beeaad7a 100755 --- a/internal/controller/eventarc/trigger/zz_controller.go +++ b/internal/controller/eventarc/trigger/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/eventarc/v1beta1" @@ -49,14 +49,18 @@ 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.Trigger_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Trigger_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_eventarc_trigger"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_eventarc_trigger"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Trigger_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/filestore/backup/zz_controller.go b/internal/controller/filestore/backup/zz_controller.go index eecf49426..d8ecd8326 100755 --- a/internal/controller/filestore/backup/zz_controller.go +++ b/internal/controller/filestore/backup/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/filestore/v1beta1" @@ -49,14 +49,18 @@ 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.Backup_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Backup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Backup_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_filestore_backup"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_filestore_backup"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Backup_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/filestore/instance/zz_controller.go b/internal/controller/filestore/instance/zz_controller.go index 79f56b034..38e9760ae 100755 --- a/internal/controller/filestore/instance/zz_controller.go +++ b/internal/controller/filestore/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/filestore/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_filestore_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_filestore_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/filestore/snapshot/zz_controller.go b/internal/controller/filestore/snapshot/zz_controller.go index d2e873082..bb42201e3 100755 --- a/internal/controller/filestore/snapshot/zz_controller.go +++ b/internal/controller/filestore/snapshot/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/filestore/v1beta1" @@ -49,14 +49,18 @@ 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.Snapshot_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Snapshot_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_filestore_snapshot"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_filestore_snapshot"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Snapshot_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/firebaserules/release/zz_controller.go b/internal/controller/firebaserules/release/zz_controller.go index 5e0adef84..372605014 100755 --- a/internal/controller/firebaserules/release/zz_controller.go +++ b/internal/controller/firebaserules/release/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/firebaserules/v1beta1" @@ -49,14 +49,18 @@ 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.Release_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Release_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Release_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_firebaserules_release"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_firebaserules_release"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Release_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/firebaserules/ruleset/zz_controller.go b/internal/controller/firebaserules/ruleset/zz_controller.go index ff59a397f..e98ab82eb 100755 --- a/internal/controller/firebaserules/ruleset/zz_controller.go +++ b/internal/controller/firebaserules/ruleset/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/firebaserules/v1beta1" @@ -48,14 +48,18 @@ 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.Ruleset_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Ruleset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Ruleset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_firebaserules_ruleset"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_firebaserules_ruleset"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Ruleset_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/gke/backupbackupplan/zz_controller.go b/internal/controller/gke/backupbackupplan/zz_controller.go index e82165698..17e050bd4 100755 --- a/internal/controller/gke/backupbackupplan/zz_controller.go +++ b/internal/controller/gke/backupbackupplan/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/gke/v1beta1" @@ -49,14 +49,18 @@ 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.BackupBackupPlan_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackupBackupPlan_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BackupBackupPlan_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_gke_backup_backup_plan"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_gke_backup_backup_plan"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BackupBackupPlan_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/gkehub/membership/zz_controller.go b/internal/controller/gkehub/membership/zz_controller.go index 895636e68..a870c1fe8 100755 --- a/internal/controller/gkehub/membership/zz_controller.go +++ b/internal/controller/gkehub/membership/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/gkehub/v1beta1" @@ -49,14 +49,18 @@ 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.Membership_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Membership_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Membership_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_gke_hub_membership"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_gke_hub_membership"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Membership_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/gkehub/membershipiammember/zz_controller.go b/internal/controller/gkehub/membershipiammember/zz_controller.go index 054a5ecc4..4e150d1dd 100755 --- a/internal/controller/gkehub/membershipiammember/zz_controller.go +++ b/internal/controller/gkehub/membershipiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/gkehub/v1beta1" @@ -48,14 +48,18 @@ 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.MembershipIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MembershipIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MembershipIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_gke_hub_membership_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_gke_hub_membership_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MembershipIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/healthcare/consentstore/zz_controller.go b/internal/controller/healthcare/consentstore/zz_controller.go index c98d579d8..6945a34cf 100755 --- a/internal/controller/healthcare/consentstore/zz_controller.go +++ b/internal/controller/healthcare/consentstore/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/healthcare/v1beta1" @@ -48,14 +48,18 @@ 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.ConsentStore_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConsentStore_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConsentStore_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_healthcare_consent_store"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_healthcare_consent_store"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConsentStore_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/healthcare/dataset/zz_controller.go b/internal/controller/healthcare/dataset/zz_controller.go index 2f03d9a02..0fef24c05 100755 --- a/internal/controller/healthcare/dataset/zz_controller.go +++ b/internal/controller/healthcare/dataset/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/healthcare/v1beta1" @@ -48,14 +48,18 @@ 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.Dataset_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dataset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dataset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_healthcare_dataset"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_healthcare_dataset"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Dataset_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/healthcare/datasetiammember/zz_controller.go b/internal/controller/healthcare/datasetiammember/zz_controller.go index 99cbc4c58..7f1aa59b9 100755 --- a/internal/controller/healthcare/datasetiammember/zz_controller.go +++ b/internal/controller/healthcare/datasetiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/healthcare/v1beta1" @@ -48,14 +48,18 @@ 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.DatasetIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatasetIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_healthcare_dataset_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_healthcare_dataset_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DatasetIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iam/workloadidentitypool/zz_controller.go b/internal/controller/iam/workloadidentitypool/zz_controller.go index e601fd25c..d4e21caaf 100755 --- a/internal/controller/iam/workloadidentitypool/zz_controller.go +++ b/internal/controller/iam/workloadidentitypool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iam/v1beta1" @@ -49,14 +49,18 @@ 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.WorkloadIdentityPool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkloadIdentityPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkloadIdentityPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iam_workload_identity_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iam_workload_identity_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkloadIdentityPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go b/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go index 8567e3d1a..f57667972 100755 --- a/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go +++ b/internal/controller/iam/workloadidentitypoolprovider/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iam/v1beta1" @@ -49,14 +49,18 @@ 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.WorkloadIdentityPoolProvider_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkloadIdentityPoolProvider_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WorkloadIdentityPoolProvider_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iam_workload_identity_pool_provider"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iam_workload_identity_pool_provider"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WorkloadIdentityPoolProvider_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iap/appengineserviceiammember/zz_controller.go b/internal/controller/iap/appengineserviceiammember/zz_controller.go index 73e42617a..c8c4ca361 100755 --- a/internal/controller/iap/appengineserviceiammember/zz_controller.go +++ b/internal/controller/iap/appengineserviceiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iap/v1beta1" @@ -48,14 +48,18 @@ 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.AppEngineServiceIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppEngineServiceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppEngineServiceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_app_engine_service_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iap_app_engine_service_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppEngineServiceIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iap/appengineversioniammember/zz_controller.go b/internal/controller/iap/appengineversioniammember/zz_controller.go index da2c61914..7d8f23bdd 100755 --- a/internal/controller/iap/appengineversioniammember/zz_controller.go +++ b/internal/controller/iap/appengineversioniammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iap/v1beta1" @@ -48,14 +48,18 @@ 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.AppEngineVersionIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppEngineVersionIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AppEngineVersionIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_app_engine_version_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iap_app_engine_version_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AppEngineVersionIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iap/tunneliammember/zz_controller.go b/internal/controller/iap/tunneliammember/zz_controller.go index 4449b0b77..af9747c50 100755 --- a/internal/controller/iap/tunneliammember/zz_controller.go +++ b/internal/controller/iap/tunneliammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iap/v1beta1" @@ -49,14 +49,18 @@ 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.TunnelIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TunnelIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TunnelIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_tunnel_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iap_tunnel_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TunnelIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iap/webbackendserviceiammember/zz_controller.go b/internal/controller/iap/webbackendserviceiammember/zz_controller.go index baded603a..35081b566 100755 --- a/internal/controller/iap/webbackendserviceiammember/zz_controller.go +++ b/internal/controller/iap/webbackendserviceiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iap/v1beta1" @@ -48,14 +48,18 @@ 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.WebBackendServiceIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebBackendServiceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebBackendServiceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_backend_service_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iap_web_backend_service_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebBackendServiceIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iap/webiammember/zz_controller.go b/internal/controller/iap/webiammember/zz_controller.go index ae21dc8c4..13f04423f 100755 --- a/internal/controller/iap/webiammember/zz_controller.go +++ b/internal/controller/iap/webiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iap/v1beta1" @@ -48,14 +48,18 @@ 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.WebIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iap_web_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iap/webtypeappengineiammember/zz_controller.go b/internal/controller/iap/webtypeappengineiammember/zz_controller.go index e3316287a..a6ec8f9c8 100755 --- a/internal/controller/iap/webtypeappengineiammember/zz_controller.go +++ b/internal/controller/iap/webtypeappengineiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iap/v1beta1" @@ -48,14 +48,18 @@ 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.WebTypeAppEngineIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebTypeAppEngineIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebTypeAppEngineIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_type_app_engine_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iap_web_type_app_engine_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebTypeAppEngineIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/iap/webtypecomputeiammember/zz_controller.go b/internal/controller/iap/webtypecomputeiammember/zz_controller.go index 1dc42e980..be1977a1a 100755 --- a/internal/controller/iap/webtypecomputeiammember/zz_controller.go +++ b/internal/controller/iap/webtypecomputeiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/iap/v1beta1" @@ -48,14 +48,18 @@ 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.WebTypeComputeIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebTypeComputeIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.WebTypeComputeIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_iap_web_type_compute_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_iap_web_type_compute_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.WebTypeComputeIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go b/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go index d7853b1a1..b8819e547 100755 --- a/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/defaultsupportedidpconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.DefaultSupportedIdPConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultSupportedIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultSupportedIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_default_supported_idp_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_default_supported_idp_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultSupportedIdPConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go b/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go index ba2fc822e..f21572c0d 100755 --- a/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go +++ b/internal/controller/identityplatform/inboundsamlconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.InboundSAMLConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InboundSAMLConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InboundSAMLConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_inbound_saml_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_inbound_saml_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InboundSAMLConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/oauthidpconfig/zz_controller.go b/internal/controller/identityplatform/oauthidpconfig/zz_controller.go index a7fef2c1c..9260e5ebb 100755 --- a/internal/controller/identityplatform/oauthidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/oauthidpconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.OAuthIdPConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OAuthIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OAuthIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_oauth_idp_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_oauth_idp_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OAuthIdPConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go b/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go index 4db978498..19c9fe656 100755 --- a/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go +++ b/internal/controller/identityplatform/projectdefaultconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.ProjectDefaultConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectDefaultConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectDefaultConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_project_default_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_project_default_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectDefaultConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/tenant/zz_controller.go b/internal/controller/identityplatform/tenant/zz_controller.go index 20f9d2da4..0f1d5bb1f 100755 --- a/internal/controller/identityplatform/tenant/zz_controller.go +++ b/internal/controller/identityplatform/tenant/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.Tenant_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tenant_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tenant_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tenant_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go b/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go index 7cb103b38..56fd643da 100755 --- a/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/tenantdefaultsupportedidpconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.TenantDefaultSupportedIdPConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TenantDefaultSupportedIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TenantDefaultSupportedIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_default_supported_idp_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_default_supported_idp_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TenantDefaultSupportedIdPConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go b/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go index 1e2738997..3ae1cd314 100755 --- a/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go +++ b/internal/controller/identityplatform/tenantinboundsamlconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.TenantInboundSAMLConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TenantInboundSAMLConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TenantInboundSAMLConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_inbound_saml_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_inbound_saml_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TenantInboundSAMLConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go b/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go index 1a792db1c..eef4c4e6c 100755 --- a/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go +++ b/internal/controller/identityplatform/tenantoauthidpconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/identityplatform/v1beta1" @@ -48,14 +48,18 @@ 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.TenantOAuthIdPConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TenantOAuthIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TenantOAuthIdPConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_oauth_idp_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_identity_platform_tenant_oauth_idp_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TenantOAuthIdPConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/kms/cryptokey/zz_controller.go b/internal/controller/kms/cryptokey/zz_controller.go index 4812da59d..d62777d0d 100755 --- a/internal/controller/kms/cryptokey/zz_controller.go +++ b/internal/controller/kms/cryptokey/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/kms/v1beta1" @@ -49,14 +49,18 @@ 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.CryptoKey_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CryptoKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CryptoKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CryptoKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/kms/cryptokeyiammember/zz_controller.go b/internal/controller/kms/cryptokeyiammember/zz_controller.go index 04ab2f68b..81979132d 100755 --- a/internal/controller/kms/cryptokeyiammember/zz_controller.go +++ b/internal/controller/kms/cryptokeyiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/kms/v1beta1" @@ -48,14 +48,18 @@ 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.CryptoKeyIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CryptoKeyIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CryptoKeyIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CryptoKeyIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/kms/cryptokeyversion/zz_controller.go b/internal/controller/kms/cryptokeyversion/zz_controller.go index a617581ba..91628375b 100755 --- a/internal/controller/kms/cryptokeyversion/zz_controller.go +++ b/internal/controller/kms/cryptokeyversion/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/kms/v1beta1" @@ -48,14 +48,18 @@ 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.CryptoKeyVersion_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CryptoKeyVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CryptoKeyVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key_version"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_kms_crypto_key_version"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CryptoKeyVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/kms/keyring/zz_controller.go b/internal/controller/kms/keyring/zz_controller.go index 47396e7af..9c37965a7 100755 --- a/internal/controller/kms/keyring/zz_controller.go +++ b/internal/controller/kms/keyring/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/kms/v1beta1" @@ -49,14 +49,18 @@ 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.KeyRing_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyRing_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyRing_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyRing_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/kms/keyringiammember/zz_controller.go b/internal/controller/kms/keyringiammember/zz_controller.go index 4df30d2cd..35ff8c317 100755 --- a/internal/controller/kms/keyringiammember/zz_controller.go +++ b/internal/controller/kms/keyringiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/kms/v1beta1" @@ -48,14 +48,18 @@ 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.KeyRingIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyRingIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyRingIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyRingIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/kms/keyringimportjob/zz_controller.go b/internal/controller/kms/keyringimportjob/zz_controller.go index 71b775383..1f131465d 100755 --- a/internal/controller/kms/keyringimportjob/zz_controller.go +++ b/internal/controller/kms/keyringimportjob/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/kms/v1beta1" @@ -49,14 +49,18 @@ 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.KeyRingImportJob_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyRingImportJob_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.KeyRingImportJob_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring_import_job"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_kms_key_ring_import_job"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.KeyRingImportJob_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/kms/secretciphertext/zz_controller.go b/internal/controller/kms/secretciphertext/zz_controller.go index 51afd16ca..6acf527c7 100755 --- a/internal/controller/kms/secretciphertext/zz_controller.go +++ b/internal/controller/kms/secretciphertext/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/kms/v1beta1" @@ -48,14 +48,18 @@ 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.SecretCiphertext_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretCiphertext_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretCiphertext_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_kms_secret_ciphertext"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_kms_secret_ciphertext"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretCiphertext_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/logging/logview/zz_controller.go b/internal/controller/logging/logview/zz_controller.go index 976cdc7e6..4f247c24c 100755 --- a/internal/controller/logging/logview/zz_controller.go +++ b/internal/controller/logging/logview/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/logging/v1beta1" @@ -49,14 +49,18 @@ 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.LogView_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LogView_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LogView_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_log_view"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_logging_log_view"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LogView_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/logging/metric/zz_controller.go b/internal/controller/logging/metric/zz_controller.go index fc5280879..03a236fa4 100755 --- a/internal/controller/logging/metric/zz_controller.go +++ b/internal/controller/logging/metric/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/logging/v1beta1" @@ -49,14 +49,18 @@ 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.Metric_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Metric_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Metric_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_metric"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_logging_metric"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Metric_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/logging/projectbucketconfig/zz_controller.go b/internal/controller/logging/projectbucketconfig/zz_controller.go index 2411957e8..b4d7f8ecd 100755 --- a/internal/controller/logging/projectbucketconfig/zz_controller.go +++ b/internal/controller/logging/projectbucketconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/logging/v1beta1" @@ -49,14 +49,18 @@ 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.ProjectBucketConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectBucketConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectBucketConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_project_bucket_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_logging_project_bucket_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectBucketConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/logging/projectexclusion/zz_controller.go b/internal/controller/logging/projectexclusion/zz_controller.go index a51fa79a4..cb19eb33c 100755 --- a/internal/controller/logging/projectexclusion/zz_controller.go +++ b/internal/controller/logging/projectexclusion/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/logging/v1beta1" @@ -49,14 +49,18 @@ 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.ProjectExclusion_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectExclusion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectExclusion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_project_exclusion"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_logging_project_exclusion"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectExclusion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/logging/projectsink/zz_controller.go b/internal/controller/logging/projectsink/zz_controller.go index 005420528..b5a89c228 100755 --- a/internal/controller/logging/projectsink/zz_controller.go +++ b/internal/controller/logging/projectsink/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/logging/v1beta1" @@ -49,14 +49,18 @@ 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.ProjectSink_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectSink_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectSink_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_logging_project_sink"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_logging_project_sink"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ProjectSink_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/memcache/instance/zz_controller.go b/internal/controller/memcache/instance/zz_controller.go index a3bdcc3bc..198d8e420 100755 --- a/internal/controller/memcache/instance/zz_controller.go +++ b/internal/controller/memcache/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/memcache/v1beta1" @@ -48,14 +48,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_memcache_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_memcache_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/mlengine/model/zz_controller.go b/internal/controller/mlengine/model/zz_controller.go index 100a8b005..dc67de6d4 100755 --- a/internal/controller/mlengine/model/zz_controller.go +++ b/internal/controller/mlengine/model/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/mlengine/v1beta1" @@ -48,14 +48,18 @@ 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.Model_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Model_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_ml_engine_model"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_ml_engine_model"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Model_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/alertpolicy/zz_controller.go b/internal/controller/monitoring/alertpolicy/zz_controller.go index 478a75c42..7a92efe8d 100755 --- a/internal/controller/monitoring/alertpolicy/zz_controller.go +++ b/internal/controller/monitoring/alertpolicy/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.AlertPolicy_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AlertPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AlertPolicy_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_alert_policy"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_alert_policy"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AlertPolicy_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/customservice/zz_controller.go b/internal/controller/monitoring/customservice/zz_controller.go index 509f21add..a8508c737 100755 --- a/internal/controller/monitoring/customservice/zz_controller.go +++ b/internal/controller/monitoring/customservice/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.CustomService_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CustomService_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_custom_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_custom_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CustomService_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/dashboard/zz_controller.go b/internal/controller/monitoring/dashboard/zz_controller.go index ec76eec77..d94af9994 100755 --- a/internal/controller/monitoring/dashboard/zz_controller.go +++ b/internal/controller/monitoring/dashboard/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.Dashboard_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dashboard_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dashboard_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_dashboard"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_dashboard"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Dashboard_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/group/zz_controller.go b/internal/controller/monitoring/group/zz_controller.go index 6cfd636d1..1f645aead 100755 --- a/internal/controller/monitoring/group/zz_controller.go +++ b/internal/controller/monitoring/group/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.Group_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Group_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_group"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_group"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Group_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/metricdescriptor/zz_controller.go b/internal/controller/monitoring/metricdescriptor/zz_controller.go index 3d321dbbf..a382898bd 100755 --- a/internal/controller/monitoring/metricdescriptor/zz_controller.go +++ b/internal/controller/monitoring/metricdescriptor/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.MetricDescriptor_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetricDescriptor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.MetricDescriptor_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_metric_descriptor"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_metric_descriptor"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.MetricDescriptor_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/notificationchannel/zz_controller.go b/internal/controller/monitoring/notificationchannel/zz_controller.go index de2bbad78..f849cfe8a 100755 --- a/internal/controller/monitoring/notificationchannel/zz_controller.go +++ b/internal/controller/monitoring/notificationchannel/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.NotificationChannel_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NotificationChannel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.NotificationChannel_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_notification_channel"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_notification_channel"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.NotificationChannel_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/service/zz_controller.go b/internal/controller/monitoring/service/zz_controller.go index 06d19f43e..1f20f9b52 100755 --- a/internal/controller/monitoring/service/zz_controller.go +++ b/internal/controller/monitoring/service/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -49,14 +49,18 @@ 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.Service_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Service_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_service"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_service"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Service_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/slo/zz_controller.go b/internal/controller/monitoring/slo/zz_controller.go index 65ff96c7d..a76439797 100755 --- a/internal/controller/monitoring/slo/zz_controller.go +++ b/internal/controller/monitoring/slo/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.SLO_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SLO_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SLO_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_slo"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_slo"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SLO_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/monitoring/uptimecheckconfig/zz_controller.go b/internal/controller/monitoring/uptimecheckconfig/zz_controller.go index 9dd2543b0..a89b7cd04 100755 --- a/internal/controller/monitoring/uptimecheckconfig/zz_controller.go +++ b/internal/controller/monitoring/uptimecheckconfig/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/monitoring/v1beta1" @@ -48,14 +48,18 @@ 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.UptimeCheckConfig_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UptimeCheckConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.UptimeCheckConfig_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_monitoring_uptime_check_config"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_monitoring_uptime_check_config"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.UptimeCheckConfig_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/networkconnectivity/hub/zz_controller.go b/internal/controller/networkconnectivity/hub/zz_controller.go index e356e98cc..5aead90ed 100755 --- a/internal/controller/networkconnectivity/hub/zz_controller.go +++ b/internal/controller/networkconnectivity/hub/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/networkconnectivity/v1beta1" @@ -48,14 +48,18 @@ 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.Hub_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Hub_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Hub_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_network_connectivity_hub"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_network_connectivity_hub"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Hub_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/networkconnectivity/spoke/zz_controller.go b/internal/controller/networkconnectivity/spoke/zz_controller.go index a7534559a..03ef7427a 100755 --- a/internal/controller/networkconnectivity/spoke/zz_controller.go +++ b/internal/controller/networkconnectivity/spoke/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/networkconnectivity/v1beta1" @@ -48,14 +48,18 @@ 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.Spoke_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Spoke_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Spoke_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_network_connectivity_spoke"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_network_connectivity_spoke"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Spoke_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/networkmanagement/connectivitytest/zz_controller.go b/internal/controller/networkmanagement/connectivitytest/zz_controller.go index c7cb496d2..0b6445c2a 100755 --- a/internal/controller/networkmanagement/connectivitytest/zz_controller.go +++ b/internal/controller/networkmanagement/connectivitytest/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/networkmanagement/v1beta1" @@ -48,14 +48,18 @@ 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.ConnectivityTest_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConnectivityTest_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ConnectivityTest_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_network_management_connectivity_test"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_network_management_connectivity_test"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ConnectivityTest_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/notebooks/environment/zz_controller.go b/internal/controller/notebooks/environment/zz_controller.go index edefa4e97..3002dd23e 100755 --- a/internal/controller/notebooks/environment/zz_controller.go +++ b/internal/controller/notebooks/environment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/notebooks/v1beta1" @@ -49,14 +49,18 @@ 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)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Environment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_environment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_notebooks_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.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/notebooks/instance/zz_controller.go b/internal/controller/notebooks/instance/zz_controller.go index 3471a209c..2c7606810 100755 --- a/internal/controller/notebooks/instance/zz_controller.go +++ b/internal/controller/notebooks/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/notebooks/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_notebooks_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/notebooks/instanceiammember/zz_controller.go b/internal/controller/notebooks/instanceiammember/zz_controller.go index 9a5895ab0..01bc36c0b 100755 --- a/internal/controller/notebooks/instanceiammember/zz_controller.go +++ b/internal/controller/notebooks/instanceiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/notebooks/v1beta1" @@ -48,14 +48,18 @@ 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.InstanceIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_instance_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_notebooks_instance_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/notebooks/runtime/zz_controller.go b/internal/controller/notebooks/runtime/zz_controller.go index 70aa1bd98..3c9f8f934 100755 --- a/internal/controller/notebooks/runtime/zz_controller.go +++ b/internal/controller/notebooks/runtime/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/notebooks/v1beta1" @@ -49,14 +49,18 @@ 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.Runtime_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Runtime_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Runtime_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_runtime"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_notebooks_runtime"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Runtime_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/notebooks/runtimeiammember/zz_controller.go b/internal/controller/notebooks/runtimeiammember/zz_controller.go index f47539b5f..361e30eb8 100755 --- a/internal/controller/notebooks/runtimeiammember/zz_controller.go +++ b/internal/controller/notebooks/runtimeiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/notebooks/v1beta1" @@ -48,14 +48,18 @@ 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.RuntimeIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RuntimeIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RuntimeIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_notebooks_runtime_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_notebooks_runtime_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RuntimeIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/osconfig/ospolicyassignment/zz_controller.go b/internal/controller/osconfig/ospolicyassignment/zz_controller.go index 2d52924c7..4febdba9e 100755 --- a/internal/controller/osconfig/ospolicyassignment/zz_controller.go +++ b/internal/controller/osconfig/ospolicyassignment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/osconfig/v1beta1" @@ -49,14 +49,18 @@ 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.OsPolicyAssignment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OsPolicyAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.OsPolicyAssignment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_os_config_os_policy_assignment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_os_config_os_policy_assignment"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.OsPolicyAssignment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/osconfig/patchdeployment/zz_controller.go b/internal/controller/osconfig/patchdeployment/zz_controller.go index c4eeeb4d0..1fe5ce689 100755 --- a/internal/controller/osconfig/patchdeployment/zz_controller.go +++ b/internal/controller/osconfig/patchdeployment/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/osconfig/v1beta1" @@ -49,14 +49,18 @@ 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.PatchDeployment_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PatchDeployment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.PatchDeployment_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_os_config_patch_deployment"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_os_config_patch_deployment"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.PatchDeployment_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/oslogin/sshpublickey/zz_controller.go b/internal/controller/oslogin/sshpublickey/zz_controller.go index 21f4a69f3..e5c8f552a 100755 --- a/internal/controller/oslogin/sshpublickey/zz_controller.go +++ b/internal/controller/oslogin/sshpublickey/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/oslogin/v1beta1" @@ -48,14 +48,18 @@ 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.SSHPublicKey_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSHPublicKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSHPublicKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_os_login_ssh_public_key"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_os_login_ssh_public_key"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SSHPublicKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/privateca/capool/zz_controller.go b/internal/controller/privateca/capool/zz_controller.go index 58a5f814d..21996a289 100755 --- a/internal/controller/privateca/capool/zz_controller.go +++ b/internal/controller/privateca/capool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/privateca/v1beta1" @@ -49,14 +49,18 @@ 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.CAPool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CAPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CAPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_ca_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_privateca_ca_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CAPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/privateca/capooliammember/zz_controller.go b/internal/controller/privateca/capooliammember/zz_controller.go index 49f85c781..248b5e7e2 100755 --- a/internal/controller/privateca/capooliammember/zz_controller.go +++ b/internal/controller/privateca/capooliammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/privateca/v1beta1" @@ -48,14 +48,18 @@ 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.CAPoolIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CAPoolIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CAPoolIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_ca_pool_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_privateca_ca_pool_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CAPoolIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/privateca/certificate/zz_controller.go b/internal/controller/privateca/certificate/zz_controller.go index 7f3cc7b8b..79fb3703c 100755 --- a/internal/controller/privateca/certificate/zz_controller.go +++ b/internal/controller/privateca/certificate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/privateca/v1beta1" @@ -49,14 +49,18 @@ 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.Certificate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Certificate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Certificate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/privateca/certificateauthority/zz_controller.go b/internal/controller/privateca/certificateauthority/zz_controller.go index 16be4f550..9d9dbdef3 100755 --- a/internal/controller/privateca/certificateauthority/zz_controller.go +++ b/internal/controller/privateca/certificateauthority/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/privateca/v1beta1" @@ -49,14 +49,18 @@ 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.CertificateAuthority_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateAuthority_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateAuthority_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_authority"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_authority"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateAuthority_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/privateca/certificatetemplate/zz_controller.go b/internal/controller/privateca/certificatetemplate/zz_controller.go index bbdf0f546..f08e37210 100755 --- a/internal/controller/privateca/certificatetemplate/zz_controller.go +++ b/internal/controller/privateca/certificatetemplate/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/privateca/v1beta1" @@ -49,14 +49,18 @@ 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.CertificateTemplate_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateTemplate_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_template"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_template"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateTemplate_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/privateca/certificatetemplateiammember/zz_controller.go b/internal/controller/privateca/certificatetemplateiammember/zz_controller.go index 8857ad26b..b47dcafe2 100755 --- a/internal/controller/privateca/certificatetemplateiammember/zz_controller.go +++ b/internal/controller/privateca/certificatetemplateiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/privateca/v1beta1" @@ -48,14 +48,18 @@ 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.CertificateTemplateIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateTemplateIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.CertificateTemplateIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_template_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_privateca_certificate_template_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.CertificateTemplateIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/litereservation/zz_controller.go b/internal/controller/pubsub/litereservation/zz_controller.go index 7f3a16d98..276a610a9 100755 --- a/internal/controller/pubsub/litereservation/zz_controller.go +++ b/internal/controller/pubsub/litereservation/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -49,14 +49,18 @@ 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.LiteReservation_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LiteReservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LiteReservation_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_reservation"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_reservation"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LiteReservation_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/litesubscription/zz_controller.go b/internal/controller/pubsub/litesubscription/zz_controller.go index 468bc840d..980d1b4d0 100755 --- a/internal/controller/pubsub/litesubscription/zz_controller.go +++ b/internal/controller/pubsub/litesubscription/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -49,14 +49,18 @@ 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.LiteSubscription_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LiteSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LiteSubscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_subscription"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_subscription"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LiteSubscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/litetopic/zz_controller.go b/internal/controller/pubsub/litetopic/zz_controller.go index d22708aaf..37893545b 100755 --- a/internal/controller/pubsub/litetopic/zz_controller.go +++ b/internal/controller/pubsub/litetopic/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -49,14 +49,18 @@ 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.LiteTopic_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LiteTopic_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.LiteTopic_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_topic"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_lite_topic"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.LiteTopic_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/schema/zz_controller.go b/internal/controller/pubsub/schema/zz_controller.go index 5e9d6a401..54160b3a3 100755 --- a/internal/controller/pubsub/schema/zz_controller.go +++ b/internal/controller/pubsub/schema/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -49,14 +49,18 @@ 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.Schema_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Schema_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Schema_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_schema"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_schema"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Schema_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/subscription/zz_controller.go b/internal/controller/pubsub/subscription/zz_controller.go index 6a2d6bb42..df13168ef 100755 --- a/internal/controller/pubsub/subscription/zz_controller.go +++ b/internal/controller/pubsub/subscription/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -49,14 +49,18 @@ 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.Subscription_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Subscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Subscription_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_subscription"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_subscription"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Subscription_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/subscriptioniammember/zz_controller.go b/internal/controller/pubsub/subscriptioniammember/zz_controller.go index fd323335c..816de6930 100755 --- a/internal/controller/pubsub/subscriptioniammember/zz_controller.go +++ b/internal/controller/pubsub/subscriptioniammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -48,14 +48,18 @@ 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.SubscriptionIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubscriptionIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SubscriptionIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_subscription_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_subscription_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SubscriptionIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/topic/zz_controller.go b/internal/controller/pubsub/topic/zz_controller.go index 1d450f0ce..c11345753 100755 --- a/internal/controller/pubsub/topic/zz_controller.go +++ b/internal/controller/pubsub/topic/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -49,14 +49,18 @@ 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.Topic_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Topic_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Topic_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_topic"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_topic"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Topic_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/pubsub/topiciammember/zz_controller.go b/internal/controller/pubsub/topiciammember/zz_controller.go index f341b8555..5269a5415 100755 --- a/internal/controller/pubsub/topiciammember/zz_controller.go +++ b/internal/controller/pubsub/topiciammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/pubsub/v1beta1" @@ -48,14 +48,18 @@ 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.TopicIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TopicIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TopicIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_pubsub_topic_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_pubsub_topic_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TopicIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/redis/instance/zz_controller.go b/internal/controller/redis/instance/zz_controller.go index 5e4baaf76..4bc941dcf 100755 --- a/internal/controller/redis/instance/zz_controller.go +++ b/internal/controller/redis/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/redis/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_redis_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_redis_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/secretmanager/secret/zz_controller.go b/internal/controller/secretmanager/secret/zz_controller.go index 9376dc9ee..53f171e01 100755 --- a/internal/controller/secretmanager/secret/zz_controller.go +++ b/internal/controller/secretmanager/secret/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/secretmanager/v1beta1" @@ -49,14 +49,18 @@ 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.Secret_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Secret_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Secret_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Secret_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/secretmanager/secretiammember/zz_controller.go b/internal/controller/secretmanager/secretiammember/zz_controller.go index 24bb8373c..18d13e08d 100755 --- a/internal/controller/secretmanager/secretiammember/zz_controller.go +++ b/internal/controller/secretmanager/secretiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/secretmanager/v1beta1" @@ -48,14 +48,18 @@ 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.SecretIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/secretmanager/secretversion/zz_controller.go b/internal/controller/secretmanager/secretversion/zz_controller.go index e9e6d7457..2ca046f24 100755 --- a/internal/controller/secretmanager/secretversion/zz_controller.go +++ b/internal/controller/secretmanager/secretversion/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/secretmanager/v1beta1" @@ -48,14 +48,18 @@ 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.SecretVersion_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SecretVersion_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret_version"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_secret_manager_secret_version"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SecretVersion_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/servicenetworking/connection/zz_controller.go b/internal/controller/servicenetworking/connection/zz_controller.go index 47e07860d..67f8c5d9d 100755 --- a/internal/controller/servicenetworking/connection/zz_controller.go +++ b/internal/controller/servicenetworking/connection/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/servicenetworking/v1beta1" @@ -48,14 +48,18 @@ 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.Connection_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connection_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_service_networking_connection"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_service_networking_connection"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connection_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/sourcerepo/repository/zz_controller.go b/internal/controller/sourcerepo/repository/zz_controller.go index 8bcfadf92..f0f2af968 100755 --- a/internal/controller/sourcerepo/repository/zz_controller.go +++ b/internal/controller/sourcerepo/repository/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/sourcerepo/v1beta1" @@ -49,14 +49,18 @@ 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.Repository_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Repository_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sourcerepo_repository"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_sourcerepo_repository"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Repository_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/sourcerepo/repositoryiammember/zz_controller.go b/internal/controller/sourcerepo/repositoryiammember/zz_controller.go index 43bba1853..86427c614 100755 --- a/internal/controller/sourcerepo/repositoryiammember/zz_controller.go +++ b/internal/controller/sourcerepo/repositoryiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/sourcerepo/v1beta1" @@ -48,14 +48,18 @@ 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.RepositoryIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RepositoryIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.RepositoryIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sourcerepo_repository_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_sourcerepo_repository_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.RepositoryIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/spanner/database/zz_controller.go b/internal/controller/spanner/database/zz_controller.go index 05e3007da..17eb1b58e 100755 --- a/internal/controller/spanner/database/zz_controller.go +++ b/internal/controller/spanner/database/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/spanner/v1beta1" @@ -49,14 +49,18 @@ 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.Database_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_database"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_spanner_database"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Database_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/spanner/databaseiammember/zz_controller.go b/internal/controller/spanner/databaseiammember/zz_controller.go index 5ab9556e7..2554028fe 100755 --- a/internal/controller/spanner/databaseiammember/zz_controller.go +++ b/internal/controller/spanner/databaseiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/spanner/v1beta1" @@ -48,14 +48,18 @@ 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.DatabaseIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatabaseIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatabaseIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_database_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_spanner_database_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DatabaseIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/spanner/instance/zz_controller.go b/internal/controller/spanner/instance/zz_controller.go index 2b1f5bd0d..0df0d8767 100755 --- a/internal/controller/spanner/instance/zz_controller.go +++ b/internal/controller/spanner/instance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/spanner/v1beta1" @@ -49,14 +49,18 @@ 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.Instance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Instance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_spanner_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Instance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/spanner/instanceiammember/zz_controller.go b/internal/controller/spanner/instanceiammember/zz_controller.go index 1afa055ed..230497a18 100755 --- a/internal/controller/spanner/instanceiammember/zz_controller.go +++ b/internal/controller/spanner/instanceiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/spanner/v1beta1" @@ -48,14 +48,18 @@ 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.InstanceIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.InstanceIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_spanner_instance_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_spanner_instance_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.InstanceIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/sql/database/zz_controller.go b/internal/controller/sql/database/zz_controller.go index 02af27a7a..a5f9fc463 100755 --- a/internal/controller/sql/database/zz_controller.go +++ b/internal/controller/sql/database/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/sql/v1beta1" @@ -49,14 +49,18 @@ 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.Database_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Database_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_database"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_sql_database"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Database_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/sql/databaseinstance/zz_controller.go b/internal/controller/sql/databaseinstance/zz_controller.go index 112fd2f9a..cb172b134 100755 --- a/internal/controller/sql/databaseinstance/zz_controller.go +++ b/internal/controller/sql/databaseinstance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/sql/v1beta1" @@ -49,14 +49,18 @@ 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.DatabaseInstance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatabaseInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DatabaseInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_database_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_sql_database_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DatabaseInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/sql/sourcerepresentationinstance/zz_controller.go b/internal/controller/sql/sourcerepresentationinstance/zz_controller.go index 3c26f5aeb..a57d3eb80 100755 --- a/internal/controller/sql/sourcerepresentationinstance/zz_controller.go +++ b/internal/controller/sql/sourcerepresentationinstance/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/sql/v1beta1" @@ -49,14 +49,18 @@ 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.SourceRepresentationInstance_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SourceRepresentationInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SourceRepresentationInstance_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_source_representation_instance"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_sql_source_representation_instance"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SourceRepresentationInstance_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/sql/sslcert/zz_controller.go b/internal/controller/sql/sslcert/zz_controller.go index c02db1283..1a7c4a62b 100755 --- a/internal/controller/sql/sslcert/zz_controller.go +++ b/internal/controller/sql/sslcert/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/sql/v1beta1" @@ -48,14 +48,18 @@ 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.SSLCert_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSLCert_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.SSLCert_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_ssl_cert"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_sql_ssl_cert"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.SSLCert_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/sql/user/zz_controller.go b/internal/controller/sql/user/zz_controller.go index 2256eec8c..02d1ab34e 100755 --- a/internal/controller/sql/user/zz_controller.go +++ b/internal/controller/sql/user/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/sql/v1beta1" @@ -49,14 +49,18 @@ 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.User_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.User_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_sql_user"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_sql_user"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.User_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/bucket/zz_controller.go b/internal/controller/storage/bucket/zz_controller.go index 337381e01..f5ce0f296 100755 --- a/internal/controller/storage/bucket/zz_controller.go +++ b/internal/controller/storage/bucket/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -49,14 +49,18 @@ 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.Bucket_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Bucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Bucket_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_bucket"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Bucket_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/bucketaccesscontrol/zz_controller.go b/internal/controller/storage/bucketaccesscontrol/zz_controller.go index cb3f2f46e..11dbba643 100755 --- a/internal/controller/storage/bucketaccesscontrol/zz_controller.go +++ b/internal/controller/storage/bucketaccesscontrol/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.BucketAccessControl_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketAccessControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketAccessControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_access_control"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_access_control"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketAccessControl_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/bucketacl/zz_controller.go b/internal/controller/storage/bucketacl/zz_controller.go index d9b2b4c4e..a211e1786 100755 --- a/internal/controller/storage/bucketacl/zz_controller.go +++ b/internal/controller/storage/bucketacl/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.BucketACL_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_acl"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_acl"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/bucketiammember/zz_controller.go b/internal/controller/storage/bucketiammember/zz_controller.go index 65ed8ec28..2daa027e4 100755 --- a/internal/controller/storage/bucketiammember/zz_controller.go +++ b/internal/controller/storage/bucketiammember/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.BucketIAMMember_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketIAMMember_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_iam_member"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_iam_member"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketIAMMember_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/bucketobject/zz_controller.go b/internal/controller/storage/bucketobject/zz_controller.go index 1eaa56c01..2ee6f8c5c 100755 --- a/internal/controller/storage/bucketobject/zz_controller.go +++ b/internal/controller/storage/bucketobject/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.BucketObject_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketObject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.BucketObject_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_object"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_bucket_object"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.BucketObject_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go b/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go index b7e2bcb4f..50a1027d1 100755 --- a/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go +++ b/internal/controller/storage/defaultobjectaccesscontrol/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.DefaultObjectAccessControl_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultObjectAccessControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultObjectAccessControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_default_object_access_control"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_default_object_access_control"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultObjectAccessControl_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/defaultobjectacl/zz_controller.go b/internal/controller/storage/defaultobjectacl/zz_controller.go index bed2cdd3b..661b84278 100755 --- a/internal/controller/storage/defaultobjectacl/zz_controller.go +++ b/internal/controller/storage/defaultobjectacl/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.DefaultObjectACL_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultObjectACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.DefaultObjectACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_default_object_acl"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_default_object_acl"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.DefaultObjectACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/notification/zz_controller.go b/internal/controller/storage/notification/zz_controller.go index c66aa4528..36a50acd6 100755 --- a/internal/controller/storage/notification/zz_controller.go +++ b/internal/controller/storage/notification/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.Notification_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Notification_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Notification_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_notification"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_notification"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Notification_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/objectaccesscontrol/zz_controller.go b/internal/controller/storage/objectaccesscontrol/zz_controller.go index 12648f032..6a5fb7604 100755 --- a/internal/controller/storage/objectaccesscontrol/zz_controller.go +++ b/internal/controller/storage/objectaccesscontrol/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.ObjectAccessControl_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObjectAccessControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObjectAccessControl_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_object_access_control"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_object_access_control"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectAccessControl_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storage/objectacl/zz_controller.go b/internal/controller/storage/objectacl/zz_controller.go index 2e0d6c66d..69831436d 100755 --- a/internal/controller/storage/objectacl/zz_controller.go +++ b/internal/controller/storage/objectacl/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storage/v1beta1" @@ -48,14 +48,18 @@ 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.ObjectACL_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObjectACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ObjectACL_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_object_acl"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_object_acl"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ObjectACL_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/storagetransfer/agentpool/zz_controller.go b/internal/controller/storagetransfer/agentpool/zz_controller.go index 368831cfc..71a777a33 100755 --- a/internal/controller/storagetransfer/agentpool/zz_controller.go +++ b/internal/controller/storagetransfer/agentpool/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/storagetransfer/v1beta1" @@ -49,14 +49,18 @@ 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.AgentPool_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AgentPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.AgentPool_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_storage_transfer_agent_pool"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_storage_transfer_agent_pool"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.AgentPool_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/tpu/node/zz_controller.go b/internal/controller/tpu/node/zz_controller.go index e40ec7206..cade2ee4e 100755 --- a/internal/controller/tpu/node/zz_controller.go +++ b/internal/controller/tpu/node/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/tpu/v1beta1" @@ -49,14 +49,18 @@ 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.Node_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Node_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Node_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_tpu_node"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_tpu_node"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Node_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/vertexai/dataset/zz_controller.go b/internal/controller/vertexai/dataset/zz_controller.go index 4d5d73961..a3c419540 100755 --- a/internal/controller/vertexai/dataset/zz_controller.go +++ b/internal/controller/vertexai/dataset/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/vertexai/v1beta1" @@ -48,14 +48,18 @@ 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.Dataset_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dataset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Dataset_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_dataset"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_dataset"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Dataset_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/vertexai/featurestore/zz_controller.go b/internal/controller/vertexai/featurestore/zz_controller.go index ccf5e2f11..a18140967 100755 --- a/internal/controller/vertexai/featurestore/zz_controller.go +++ b/internal/controller/vertexai/featurestore/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/vertexai/v1beta1" @@ -48,14 +48,18 @@ 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.Featurestore_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Featurestore_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Featurestore_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_featurestore"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_featurestore"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Featurestore_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/vertexai/featurestoreentitytype/zz_controller.go b/internal/controller/vertexai/featurestoreentitytype/zz_controller.go index 6c17aa0f4..4581e803b 100755 --- a/internal/controller/vertexai/featurestoreentitytype/zz_controller.go +++ b/internal/controller/vertexai/featurestoreentitytype/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/vertexai/v1beta1" @@ -48,14 +48,18 @@ 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.FeaturestoreEntitytype_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FeaturestoreEntitytype_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.FeaturestoreEntitytype_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_featurestore_entitytype"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_featurestore_entitytype"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.FeaturestoreEntitytype_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/vertexai/tensorboard/zz_controller.go b/internal/controller/vertexai/tensorboard/zz_controller.go index f311be11e..6504714cf 100755 --- a/internal/controller/vertexai/tensorboard/zz_controller.go +++ b/internal/controller/vertexai/tensorboard/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/vertexai/v1beta1" @@ -49,14 +49,18 @@ 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.Tensorboard_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tensorboard_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Tensorboard_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_tensorboard"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_vertex_ai_tensorboard"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Tensorboard_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/vpcaccess/connector/zz_controller.go b/internal/controller/vpcaccess/connector/zz_controller.go index 54ba785da..0051904f6 100755 --- a/internal/controller/vpcaccess/connector/zz_controller.go +++ b/internal/controller/vpcaccess/connector/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/vpcaccess/v1beta1" @@ -49,14 +49,18 @@ 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.Connector_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connector_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Connector_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_vpc_access_connector"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_vpc_access_connector"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Connector_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...), diff --git a/internal/controller/workflows/workflow/zz_controller.go b/internal/controller/workflows/workflow/zz_controller.go index a1fcb017e..1a4891164 100755 --- a/internal/controller/workflows/workflow/zz_controller.go +++ b/internal/controller/workflows/workflow/zz_controller.go @@ -32,7 +32,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/terraform" + "github.com/crossplane/upjet/pkg/metrics" ctrl "sigs.k8s.io/controller-runtime" v1beta1 "github.com/upbound/provider-gcp/apis/workflows/v1beta1" @@ -48,14 +48,18 @@ 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.Workflow_GroupVersionKind))) - ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workflow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler)) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.Workflow_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) opts := []managed.ReconcilerOption{ - managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_workflows_workflow"], tjcontroller.WithLogger(o.Logger), tjcontroller.WithConnectorEventHandler(eventHandler), - tjcontroller.WithCallbackProvider(ac), - )), + managed.WithExternalConnecter( + tjcontroller.NewNoForkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_workflows_workflow"], + tjcontroller.WithNoForkAsyncLogger(o.Logger), + tjcontroller.WithNoForkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithNoForkAsyncCallbackProvider(ac), + tjcontroller.WithNoForkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.Workflow_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithNoForkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), managed.WithLogger(o.Logger.WithValues("controller", name)), managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), - managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithFinalizer(tjcontroller.NewNoForkFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), managed.WithTimeout(3 * time.Minute), managed.WithInitializers(initializers), managed.WithConnectionPublishers(cps...),