From 617729496cbd0ad5cabc8f1b2d22484acd339fb6 Mon Sep 17 00:00:00 2001 From: SK Ali Arman Date: Thu, 14 Dec 2023 18:59:21 +0600 Subject: [PATCH] Add Signed-off-by: SK Ali Arman --- .../v1alpha1/zz_generated_terraformed.go | 31 + .../v1alpha1/zz_generated_terraformed.go | 91 +++ .../v1alpha1/zz_generated_terraformed.go | 151 +++++ .../v1alpha1/zz_generated_terraformed.go | 541 ++++++++++++++++ .../v1alpha1/zz_generated_terraformed.go | 151 +++++ .../v1alpha1/zz_generated_terraformed.go | 301 +++++++++ .../v1alpha1/zz_generated_terraformed.go | 331 ++++++++++ .../v1alpha1/zz_generated_terraformed.go | 61 ++ .../v1alpha1/zz_generated_terraformed.go | 271 ++++++++ apis/sql/v1alpha1/zz_generated_terraformed.go | 601 ++++++++++++++++++ .../v1alpha1/zz_generated_terraformed.go | 61 ++ cmd/generator/main.go | 190 +++++- go.mod | 9 +- go.sum | 7 +- 14 files changed, 2787 insertions(+), 10 deletions(-) diff --git a/apis/authorization/v1alpha1/zz_generated_terraformed.go b/apis/authorization/v1alpha1/zz_generated_terraformed.go index 101e7ec..58f8e78 100755 --- a/apis/authorization/v1alpha1/zz_generated_terraformed.go +++ b/apis/authorization/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *RoleAssignment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RoleAssignment +func (tr *RoleAssignment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RoleAssignment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RoleAssignment) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/azure/v1alpha1/zz_generated_terraformed.go b/apis/azure/v1alpha1/zz_generated_terraformed.go index 87e6d13..73cbe1a 100755 --- a/apis/azure/v1alpha1/zz_generated_terraformed.go +++ b/apis/azure/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *ResourceGroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ResourceGroup +func (tr *ResourceGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ResourceGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ResourceGroup) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *ProviderRegistration) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ProviderRegistration +func (tr *ProviderRegistration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ProviderRegistration using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ProviderRegistration) LateInitialize(attrs []byte) (bool, error) { @@ -251,6 +312,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) { diff --git a/apis/cache/v1alpha1/zz_generated_terraformed.go b/apis/cache/v1alpha1/zz_generated_terraformed.go index 5db9635..6e1fbda 100755 --- a/apis/cache/v1alpha1/zz_generated_terraformed.go +++ b/apis/cache/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *RedisCache) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RedisCache +func (tr *RedisCache) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RedisCache using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RedisCache) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *RedisEnterpriseCluster) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RedisEnterpriseCluster +func (tr *RedisEnterpriseCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RedisEnterpriseCluster using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RedisEnterpriseCluster) LateInitialize(attrs []byte) (bool, error) { @@ -251,6 +312,36 @@ func (tr *RedisEnterpriseDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RedisEnterpriseDatabase +func (tr *RedisEnterpriseDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RedisEnterpriseDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RedisEnterpriseDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -335,6 +426,36 @@ func (tr *RedisFirewallRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RedisFirewallRule +func (tr *RedisFirewallRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RedisFirewallRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RedisFirewallRule) LateInitialize(attrs []byte) (bool, error) { @@ -419,6 +540,36 @@ func (tr *RedisLinkedServer) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RedisLinkedServer +func (tr *RedisLinkedServer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RedisLinkedServer using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RedisLinkedServer) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/cosmosdb/v1alpha1/zz_generated_terraformed.go b/apis/cosmosdb/v1alpha1/zz_generated_terraformed.go index 07d8e45..3213d3f 100755 --- a/apis/cosmosdb/v1alpha1/zz_generated_terraformed.go +++ b/apis/cosmosdb/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *Account) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Account +func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Account using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Account) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *CassandraCluster) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CassandraCluster +func (tr *CassandraCluster) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CassandraCluster using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CassandraCluster) LateInitialize(attrs []byte) (bool, error) { @@ -251,6 +312,36 @@ func (tr *CassandraDatacenter) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CassandraDatacenter +func (tr *CassandraDatacenter) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CassandraDatacenter using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CassandraDatacenter) LateInitialize(attrs []byte) (bool, error) { @@ -335,6 +426,36 @@ func (tr *CassandraKeySpace) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CassandraKeySpace +func (tr *CassandraKeySpace) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CassandraKeySpace using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CassandraKeySpace) LateInitialize(attrs []byte) (bool, error) { @@ -419,6 +540,36 @@ func (tr *CassandraTable) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this CassandraTable +func (tr *CassandraTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this CassandraTable using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *CassandraTable) LateInitialize(attrs []byte) (bool, error) { @@ -504,6 +655,36 @@ func (tr *GremlinDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this GremlinDatabase +func (tr *GremlinDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this GremlinDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *GremlinDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -588,6 +769,36 @@ func (tr *GremlinGraph) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this GremlinGraph +func (tr *GremlinGraph) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this GremlinGraph using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *GremlinGraph) LateInitialize(attrs []byte) (bool, error) { @@ -672,6 +883,36 @@ func (tr *MongoCollection) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MongoCollection +func (tr *MongoCollection) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MongoCollection using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MongoCollection) LateInitialize(attrs []byte) (bool, error) { @@ -756,6 +997,36 @@ func (tr *MongoDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MongoDatabase +func (tr *MongoDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MongoDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MongoDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -840,6 +1111,36 @@ func (tr *SQLContainer) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLContainer +func (tr *SQLContainer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLContainer using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLContainer) LateInitialize(attrs []byte) (bool, error) { @@ -924,6 +1225,36 @@ func (tr *SQLDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLDatabase +func (tr *SQLDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -1008,6 +1339,36 @@ func (tr *SQLDedicatedGateway) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLDedicatedGateway +func (tr *SQLDedicatedGateway) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLDedicatedGateway using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLDedicatedGateway) LateInitialize(attrs []byte) (bool, error) { @@ -1092,6 +1453,36 @@ func (tr *SQLFunction) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLFunction +func (tr *SQLFunction) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLFunction using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLFunction) LateInitialize(attrs []byte) (bool, error) { @@ -1176,6 +1567,36 @@ func (tr *SQLRoleAssignment) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLRoleAssignment +func (tr *SQLRoleAssignment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLRoleAssignment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLRoleAssignment) LateInitialize(attrs []byte) (bool, error) { @@ -1260,6 +1681,36 @@ func (tr *SQLRoleDefinition) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLRoleDefinition +func (tr *SQLRoleDefinition) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLRoleDefinition using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLRoleDefinition) LateInitialize(attrs []byte) (bool, error) { @@ -1344,6 +1795,36 @@ func (tr *SQLStoredProcedure) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLStoredProcedure +func (tr *SQLStoredProcedure) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLStoredProcedure using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLStoredProcedure) LateInitialize(attrs []byte) (bool, error) { @@ -1428,6 +1909,36 @@ func (tr *SQLTrigger) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SQLTrigger +func (tr *SQLTrigger) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SQLTrigger using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SQLTrigger) LateInitialize(attrs []byte) (bool, error) { @@ -1512,6 +2023,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) { diff --git a/apis/dbformariadb/v1alpha1/zz_generated_terraformed.go b/apis/dbformariadb/v1alpha1/zz_generated_terraformed.go index 17c9432..89207c9 100755 --- a/apis/dbformariadb/v1alpha1/zz_generated_terraformed.go +++ b/apis/dbformariadb/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *Configuration) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Configuration +func (tr *Configuration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Configuration using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Configuration) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,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) { @@ -251,6 +312,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) { @@ -335,6 +426,36 @@ func (tr *Server) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Server +func (tr *Server) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Server using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Server) LateInitialize(attrs []byte) (bool, error) { @@ -419,6 +540,36 @@ func (tr *VirtualNetworkRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this VirtualNetworkRule +func (tr *VirtualNetworkRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this VirtualNetworkRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *VirtualNetworkRule) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/dbformysql/v1alpha1/zz_generated_terraformed.go b/apis/dbformysql/v1alpha1/zz_generated_terraformed.go index ff91503..5013d92 100755 --- a/apis/dbformysql/v1alpha1/zz_generated_terraformed.go +++ b/apis/dbformysql/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *ActiveDirectoryAdministrator) GetInitParameters() (map[string]any, err return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ActiveDirectoryAdministrator +func (tr *ActiveDirectoryAdministrator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ActiveDirectoryAdministrator using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ActiveDirectoryAdministrator) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *Configuration) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Configuration +func (tr *Configuration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Configuration using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Configuration) LateInitialize(attrs []byte) (bool, error) { @@ -251,6 +312,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) { @@ -335,6 +426,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) { @@ -419,6 +540,36 @@ func (tr *FlexibleDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleDatabase +func (tr *FlexibleDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -503,6 +654,36 @@ func (tr *FlexibleServer) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleServer +func (tr *FlexibleServer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleServer using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleServer) LateInitialize(attrs []byte) (bool, error) { @@ -587,6 +768,36 @@ func (tr *FlexibleServerConfiguration) GetInitParameters() (map[string]any, erro return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleServerConfiguration +func (tr *FlexibleServerConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleServerConfiguration using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleServerConfiguration) LateInitialize(attrs []byte) (bool, error) { @@ -671,6 +882,36 @@ func (tr *FlexibleServerFirewallRule) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleServerFirewallRule +func (tr *FlexibleServerFirewallRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleServerFirewallRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleServerFirewallRule) LateInitialize(attrs []byte) (bool, error) { @@ -755,6 +996,36 @@ func (tr *Server) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Server +func (tr *Server) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Server using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Server) LateInitialize(attrs []byte) (bool, error) { @@ -839,6 +1110,36 @@ func (tr *VirtualNetworkRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this VirtualNetworkRule +func (tr *VirtualNetworkRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this VirtualNetworkRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *VirtualNetworkRule) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/dbforpostgresql/v1alpha1/zz_generated_terraformed.go b/apis/dbforpostgresql/v1alpha1/zz_generated_terraformed.go index 8395931..e0a5c1e 100755 --- a/apis/dbforpostgresql/v1alpha1/zz_generated_terraformed.go +++ b/apis/dbforpostgresql/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *ActiveDirectoryAdministrator) GetInitParameters() (map[string]any, err return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ActiveDirectoryAdministrator +func (tr *ActiveDirectoryAdministrator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ActiveDirectoryAdministrator using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ActiveDirectoryAdministrator) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *Configuration) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Configuration +func (tr *Configuration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Configuration using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Configuration) LateInitialize(attrs []byte) (bool, error) { @@ -251,6 +312,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) { @@ -335,6 +426,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) { @@ -419,6 +540,36 @@ func (tr *FlexibleServer) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleServer +func (tr *FlexibleServer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleServer using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleServer) LateInitialize(attrs []byte) (bool, error) { @@ -503,6 +654,36 @@ func (tr *FlexibleServerConfiguration) GetInitParameters() (map[string]any, erro return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleServerConfiguration +func (tr *FlexibleServerConfiguration) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleServerConfiguration using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleServerConfiguration) LateInitialize(attrs []byte) (bool, error) { @@ -587,6 +768,36 @@ func (tr *FlexibleServerDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleServerDatabase +func (tr *FlexibleServerDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleServerDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleServerDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -671,6 +882,36 @@ func (tr *FlexibleServerFirewallRule) GetInitParameters() (map[string]any, error return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this FlexibleServerFirewallRule +func (tr *FlexibleServerFirewallRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this FlexibleServerFirewallRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *FlexibleServerFirewallRule) LateInitialize(attrs []byte) (bool, error) { @@ -755,6 +996,36 @@ func (tr *Server) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Server +func (tr *Server) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Server using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Server) LateInitialize(attrs []byte) (bool, error) { @@ -839,6 +1110,36 @@ func (tr *ServerKey) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this ServerKey +func (tr *ServerKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this ServerKey using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *ServerKey) LateInitialize(attrs []byte) (bool, error) { @@ -923,6 +1224,36 @@ func (tr *VirtualNetworkRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this VirtualNetworkRule +func (tr *VirtualNetworkRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this VirtualNetworkRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *VirtualNetworkRule) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/keyvault/v1alpha1/zz_generated_terraformed.go b/apis/keyvault/v1alpha1/zz_generated_terraformed.go index 4280515..a9f56e0 100755 --- a/apis/keyvault/v1alpha1/zz_generated_terraformed.go +++ b/apis/keyvault/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *Vault) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Vault +func (tr *Vault) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Vault using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Vault) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *Key) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Key +func (tr *Key) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Key using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Key) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/network/v1alpha1/zz_generated_terraformed.go b/apis/network/v1alpha1/zz_generated_terraformed.go index 0261cc6..4350248 100755 --- a/apis/network/v1alpha1/zz_generated_terraformed.go +++ b/apis/network/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *SecurityGroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SecurityGroup +func (tr *SecurityGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SecurityGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SecurityGroup) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *PrivateDNSZone) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this PrivateDNSZone +func (tr *PrivateDNSZone) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this PrivateDNSZone using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *PrivateDNSZone) LateInitialize(attrs []byte) (bool, error) { @@ -251,6 +312,36 @@ func (tr *PrivateDNSZoneVirtualNetworkLink) GetInitParameters() (map[string]any, return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this PrivateDNSZoneVirtualNetworkLink +func (tr *PrivateDNSZoneVirtualNetworkLink) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this PrivateDNSZoneVirtualNetworkLink using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *PrivateDNSZoneVirtualNetworkLink) LateInitialize(attrs []byte) (bool, error) { @@ -335,6 +426,36 @@ func (tr *RouteTable) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this RouteTable +func (tr *RouteTable) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this RouteTable using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *RouteTable) LateInitialize(attrs []byte) (bool, error) { @@ -419,6 +540,36 @@ func (tr *Subnet) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Subnet +func (tr *Subnet) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Subnet using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Subnet) LateInitialize(attrs []byte) (bool, error) { @@ -503,6 +654,36 @@ func (tr *SubnetNetworkSecurityGroupAssociation) GetInitParameters() (map[string return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SubnetNetworkSecurityGroupAssociation +func (tr *SubnetNetworkSecurityGroupAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SubnetNetworkSecurityGroupAssociation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SubnetNetworkSecurityGroupAssociation) LateInitialize(attrs []byte) (bool, error) { @@ -587,6 +768,36 @@ func (tr *SubnetRouteTableAssociation) GetInitParameters() (map[string]any, erro return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this SubnetRouteTableAssociation +func (tr *SubnetRouteTableAssociation) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this SubnetRouteTableAssociation using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *SubnetRouteTableAssociation) LateInitialize(attrs []byte) (bool, error) { @@ -671,6 +882,36 @@ func (tr *VirtualNetwork) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this VirtualNetwork +func (tr *VirtualNetwork) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this VirtualNetwork using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *VirtualNetwork) LateInitialize(attrs []byte) (bool, error) { @@ -756,6 +997,36 @@ func (tr *VirtualNetworkPeering) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this VirtualNetworkPeering +func (tr *VirtualNetworkPeering) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this VirtualNetworkPeering using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *VirtualNetworkPeering) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/sql/v1alpha1/zz_generated_terraformed.go b/apis/sql/v1alpha1/zz_generated_terraformed.go index e7f92e7..1036752 100755 --- a/apis/sql/v1alpha1/zz_generated_terraformed.go +++ b/apis/sql/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *MSSQLDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLDatabase +func (tr *MSSQLDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -169,6 +200,36 @@ func (tr *MSSQLServerMicrosoftSupportAuditingPolicy) GetInitParameters() (map[st return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLServerMicrosoftSupportAuditingPolicy +func (tr *MSSQLServerMicrosoftSupportAuditingPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLServerMicrosoftSupportAuditingPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLServerMicrosoftSupportAuditingPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -253,6 +314,36 @@ func (tr *MSSQLDatabaseVulnerabilityAssessmentRuleBaseline) GetInitParameters() return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLDatabaseVulnerabilityAssessmentRuleBaseline +func (tr *MSSQLDatabaseVulnerabilityAssessmentRuleBaseline) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLDatabaseVulnerabilityAssessmentRuleBaseline using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLDatabaseVulnerabilityAssessmentRuleBaseline) LateInitialize(attrs []byte) (bool, error) { @@ -337,6 +428,36 @@ func (tr *MSSQLElasticPool) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLElasticPool +func (tr *MSSQLElasticPool) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLElasticPool using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLElasticPool) LateInitialize(attrs []byte) (bool, error) { @@ -422,6 +543,36 @@ func (tr *MSSQLFailoverGroup) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLFailoverGroup +func (tr *MSSQLFailoverGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLFailoverGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLFailoverGroup) LateInitialize(attrs []byte) (bool, error) { @@ -506,6 +657,36 @@ func (tr *MSSQLFirewallRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLFirewallRule +func (tr *MSSQLFirewallRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLFirewallRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLFirewallRule) LateInitialize(attrs []byte) (bool, error) { @@ -590,6 +771,36 @@ func (tr *MSSQLJobAgent) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLJobAgent +func (tr *MSSQLJobAgent) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLJobAgent using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLJobAgent) LateInitialize(attrs []byte) (bool, error) { @@ -674,6 +885,36 @@ func (tr *MSSQLJobCredential) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLJobCredential +func (tr *MSSQLJobCredential) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLJobCredential using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLJobCredential) LateInitialize(attrs []byte) (bool, error) { @@ -758,6 +999,36 @@ func (tr *MSSQLManagedDatabase) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLManagedDatabase +func (tr *MSSQLManagedDatabase) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLManagedDatabase using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLManagedDatabase) LateInitialize(attrs []byte) (bool, error) { @@ -842,6 +1113,36 @@ func (tr *MSSQLManagedInstance) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLManagedInstance +func (tr *MSSQLManagedInstance) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLManagedInstance using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLManagedInstance) LateInitialize(attrs []byte) (bool, error) { @@ -926,6 +1227,36 @@ func (tr *MSSQLManagedInstanceActiveDirectoryAdministrator) GetInitParameters() return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLManagedInstanceActiveDirectoryAdministrator +func (tr *MSSQLManagedInstanceActiveDirectoryAdministrator) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLManagedInstanceActiveDirectoryAdministrator using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLManagedInstanceActiveDirectoryAdministrator) LateInitialize(attrs []byte) (bool, error) { @@ -1010,6 +1341,36 @@ func (tr *MSSQLManagedInstanceFailoverGroup) GetInitParameters() (map[string]any return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLManagedInstanceFailoverGroup +func (tr *MSSQLManagedInstanceFailoverGroup) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLManagedInstanceFailoverGroup using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLManagedInstanceFailoverGroup) LateInitialize(attrs []byte) (bool, error) { @@ -1094,6 +1455,36 @@ func (tr *MSSQLManagedInstanceVulnerabilityAssessment) GetInitParameters() (map[ return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLManagedInstanceVulnerabilityAssessment +func (tr *MSSQLManagedInstanceVulnerabilityAssessment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLManagedInstanceVulnerabilityAssessment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLManagedInstanceVulnerabilityAssessment) LateInitialize(attrs []byte) (bool, error) { @@ -1178,6 +1569,36 @@ func (tr *MSSQLOutboundFirewallRule) GetInitParameters() (map[string]any, error) return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLOutboundFirewallRule +func (tr *MSSQLOutboundFirewallRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLOutboundFirewallRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLOutboundFirewallRule) LateInitialize(attrs []byte) (bool, error) { @@ -1262,6 +1683,36 @@ func (tr *MSSQLServer) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLServer +func (tr *MSSQLServer) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLServer using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLServer) LateInitialize(attrs []byte) (bool, error) { @@ -1346,6 +1797,36 @@ func (tr *MSSQLServerDNSAlias) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLServerDNSAlias +func (tr *MSSQLServerDNSAlias) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLServerDNSAlias using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLServerDNSAlias) LateInitialize(attrs []byte) (bool, error) { @@ -1430,6 +1911,36 @@ func (tr *MSSQLServerSecurityAlertPolicy) GetInitParameters() (map[string]any, e return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLServerSecurityAlertPolicy +func (tr *MSSQLServerSecurityAlertPolicy) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLServerSecurityAlertPolicy using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLServerSecurityAlertPolicy) LateInitialize(attrs []byte) (bool, error) { @@ -1514,6 +2025,36 @@ func (tr *MSSQLServerTransparentDataEncryption) GetInitParameters() (map[string] return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLServerTransparentDataEncryption +func (tr *MSSQLServerTransparentDataEncryption) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLServerTransparentDataEncryption using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLServerTransparentDataEncryption) LateInitialize(attrs []byte) (bool, error) { @@ -1598,6 +2139,36 @@ func (tr *MSSQLServerVulnerabilityAssessment) GetInitParameters() (map[string]an return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLServerVulnerabilityAssessment +func (tr *MSSQLServerVulnerabilityAssessment) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLServerVulnerabilityAssessment using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLServerVulnerabilityAssessment) LateInitialize(attrs []byte) (bool, error) { @@ -1682,6 +2253,36 @@ func (tr *MSSQLVirtualNetworkRule) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this MSSQLVirtualNetworkRule +func (tr *MSSQLVirtualNetworkRule) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this MSSQLVirtualNetworkRule using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *MSSQLVirtualNetworkRule) LateInitialize(attrs []byte) (bool, error) { diff --git a/apis/storage/v1alpha1/zz_generated_terraformed.go b/apis/storage/v1alpha1/zz_generated_terraformed.go index df8317a..1f7359b 100755 --- a/apis/storage/v1alpha1/zz_generated_terraformed.go +++ b/apis/storage/v1alpha1/zz_generated_terraformed.go @@ -11,6 +11,7 @@ Copyright 2022 Upbound Inc. package v1alpha1 import ( + "dario.cat/mergo" "github.com/pkg/errors" "github.com/crossplane/upjet/pkg/resource" @@ -83,6 +84,36 @@ func (tr *Account) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Account +func (tr *Account) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Account using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Account) LateInitialize(attrs []byte) (bool, error) { @@ -167,6 +198,36 @@ func (tr *Container) GetInitParameters() (map[string]any, error) { return base, json.TFParser.Unmarshal(p, &base) } +// GetInitParameters of this Container +func (tr *Container) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + // LateInitialize this Container using its observed tfState. // returns True if there are any spec changes for the resource. func (tr *Container) LateInitialize(attrs []byte) (bool, error) { diff --git a/cmd/generator/main.go b/cmd/generator/main.go index bb015bb..749adc3 100644 --- a/cmd/generator/main.go +++ b/cmd/generator/main.go @@ -6,14 +6,24 @@ package main import ( "fmt" + "github.com/crossplane/crossplane-runtime/pkg/errors" + "github.com/crossplane/upjet/pkg/config" + "github.com/crossplane/upjet/pkg/examples" + "github.com/crossplane/upjet/pkg/pipeline" "os" + "os/exec" "path/filepath" + "sort" + "strings" - "github.com/crossplane/upjet/pkg/pipeline" - - "kubedb.dev/provider-azure/config" + pconfig "kubedb.dev/provider-azure/config" ) +type TerraformedInput struct { + *config.Resource + ParametersTypeName string +} + func main() { if len(os.Args) < 2 || os.Args[1] == "" { panic("root directory is required to be given as argument") @@ -23,5 +33,177 @@ func main() { if err != nil { panic(fmt.Sprintf("cannot calculate the absolute path with %s", rootDir)) } - pipeline.Run(config.GetProvider(), absRootDir) + pipeline.Run(pconfig.GetProvider(), absRootDir) + + pc := pconfig.GetProvider() + /*fmt.Println(pc.ModulePath, " !!!! ", pc.MainTemplate) + i := 0 + for p, g := range pc.BasePackages.ControllerMap { + fmt.Println(i, " ", p, " ", g, "", config.PackageNameMonolith) + i += 1 + } + j := 0 + for st, re := range pc.Resources { + group := pc.RootGroup + + if re.ShortGroup != "" { + group = strings.ToLower(re.ShortGroup) + "." + pc.RootGroup + } + sGroup := strings.Split(group, ".")[0] + fmt.Println(j, " ", st, " ", group, " ", sGroup) + j += 1 + } + cnt := 0 + for _, p := range pc.BasePackages.Controller { + path := filepath.Join(pc.ModulePath, p) + fmt.Println(cnt, " ", path) + cnt += 1 + }*/ + + resourcesGroups := map[string]map[string]map[string]*config.Resource{} + for name, resource := range pc.Resources { + group := pc.RootGroup + if resource.ShortGroup != "" { + group = strings.ToLower(resource.ShortGroup) + "." + pc.RootGroup + } + if len(resourcesGroups[group]) == 0 { + resourcesGroups[group] = map[string]map[string]*config.Resource{} + } + if len(resourcesGroups[group][resource.Version]) == 0 { + resourcesGroups[group][resource.Version] = map[string]*config.Resource{} + } + resourcesGroups[group][resource.Version][name] = resource + } + + exampleGen := examples.NewGenerator(rootDir, pc.ModulePath, pc.ShortName, pc.Resources) + if err := exampleGen.SetReferenceTypes(pc.Resources); err != nil { + panic(errors.Wrap(err, "cannot set reference types for resources")) + } + // Add ProviderConfig API package to the list of API version packages. + apiVersionPkgList := make([]string, 0) + for _, p := range pc.BasePackages.APIVersion { + apiVersionPkgList = append(apiVersionPkgList, filepath.Join(pc.ModulePath, p)) + } + // Add ProviderConfig controller package to the list of controller packages. + controllerPkgMap := make(map[string][]string) + // new API takes precedence + for p, g := range pc.BasePackages.ControllerMap { + path := filepath.Join(pc.ModulePath, p) + controllerPkgMap[g] = append(controllerPkgMap[g], path) + controllerPkgMap[config.PackageNameMonolith] = append(controllerPkgMap[config.PackageNameMonolith], path) + } + //nolint:staticcheck + for _, p := range pc.BasePackages.Controller { + path := filepath.Join(pc.ModulePath, p) + found := false + for _, p := range controllerPkgMap[config.PackageNameConfig] { + if path == p { + found = true + break + } + } + if !found { + controllerPkgMap[config.PackageNameConfig] = append(controllerPkgMap[config.PackageNameConfig], path) + } + found = false + for _, p := range controllerPkgMap[config.PackageNameMonolith] { + if path == p { + found = true + break + } + } + if !found { + controllerPkgMap[config.PackageNameMonolith] = append(controllerPkgMap[config.PackageNameMonolith], path) + } + } + count := 0 + for group, versions := range resourcesGroups { + for version, resources := range versions { + versionGen := pipeline.NewVersionGenerator(rootDir, pc.ModulePath, group, version) + crdGen := pipeline.NewCRDGenerator(versionGen.Package(), rootDir, pc.ShortName, group, version) + var _ = pipeline.NewTerraformedGenerator(versionGen.Package(), rootDir, group, version) + ctrlGen := pipeline.NewControllerGenerator(rootDir, pc.ModulePath, group) + + for _, name := range sortedResources(resources) { + _, err := crdGen.Generate(resources[name]) + if err != nil { + panic(errors.Wrapf(err, "cannot generate crd for resource %s", name)) + } + + featuresPkgPath := "" + if pc.FeaturesPackage != "" { + featuresPkgPath = filepath.Join(pc.ModulePath, pc.FeaturesPackage) + } + ctrlPkgPath, err := ctrlGen.Generate(resources[name], versionGen.Package().Path(), featuresPkgPath) + if err != nil { + panic(errors.Wrapf(err, "cannot generate controller for resource %s", name)) + } + sGroup := strings.Split(group, ".")[0] + controllerPkgMap[sGroup] = append(controllerPkgMap[sGroup], ctrlPkgPath) + controllerPkgMap[config.PackageNameMonolith] = append(controllerPkgMap[config.PackageNameMonolith], ctrlPkgPath) + if err := exampleGen.Generate(group, version, resources[name]); err != nil { + panic(errors.Wrapf(err, "cannot generate example manifest for resource %s", name)) + } + count++ + } + + if err := versionGen.Generate(); err != nil { + panic(errors.Wrap(err, "cannot generate version files")) + } + apiVersionPkgList = append(apiVersionPkgList, versionGen.Package().Path()) + } + } + + if err := exampleGen.StoreExamples(); err != nil { + panic(errors.Wrapf(err, "cannot store examples")) + } + + if err := pipeline.NewRegisterGenerator(rootDir, pc.ModulePath).Generate(apiVersionPkgList); err != nil { + panic(errors.Wrap(err, "cannot generate register file")) + } + + // Generate the provider, + // i.e. the setup function and optionally the provider's main program. + i := 0 + for ke, va := range controllerPkgMap { + fmt.Println(i, " ", ke) + j := 0 + for _, v := range va { + fmt.Println(j, " ", v) + j += 1 + } + + i += 1 + } + if err := pipeline.NewProviderGenerator(rootDir, pc.ModulePath).Generate(controllerPkgMap, pc.MainTemplate); err != nil { + panic(errors.Wrap(err, "cannot generate setup file")) + } + + // NOTE(muvaf): gosec linter requires that the whole command is hard-coded. + // So, we set the directory of the command instead of passing in the directory + // as an argument to "find". + apisCmd := exec.Command("bash", "-c", "goimports -w $(find . -iname 'zz_*')") + apisCmd.Dir = filepath.Clean(filepath.Join(rootDir, "apis")) + if out, err := apisCmd.CombinedOutput(); err != nil { + panic(errors.Wrap(err, "cannot run goimports for apis folder: "+string(out))) + } + + internalCmd := exec.Command("bash", "-c", "goimports -w $(find . -iname 'zz_*')") + internalCmd.Dir = filepath.Clean(filepath.Join(rootDir, "internal")) + if out, err := internalCmd.CombinedOutput(); err != nil { + panic(errors.Wrap(err, "cannot run goimports for internal folder: "+string(out))) + } + + fmt.Printf("\nGenerated %d resources!!!\n", count) +} + +func sortedResources(m map[string]*config.Resource) []string { + result := make([]string, len(m)) + i := 0 + for g := range m { + result[i] = g + i++ + } + sort.Strings(result) + return result } diff --git a/go.mod b/go.mod index 1579540..fa79176 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,23 @@ module kubedb.dev/provider-azure go 1.19 require ( + dario.cat/mergo v1.0.0 github.com/crossplane/crossplane-runtime v1.14.0-rc.0.0.20231011070344-cc691421c2e5 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-plugin-sdk/v2 v2.24.0 github.com/pkg/errors v0.9.1 gopkg.in/alecthomas/kingpin.v2 v2.2.6 k8s.io/api v0.28.2 + k8s.io/apiextensions-apiserver v0.28.2 k8s.io/apimachinery v0.28.2 k8s.io/client-go v0.28.2 + k8s.io/klog/v2 v2.100.1 sigs.k8s.io/controller-runtime v0.16.2 sigs.k8s.io/controller-tools v0.13.0 ) require ( - dario.cat/mergo v1.0.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 @@ -90,6 +92,7 @@ require ( github.com/vmihailenco/tagparser v0.1.1 // 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.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect @@ -109,9 +112,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.28.2 // indirect k8s.io/component-base v0.28.2 // indirect - k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/go.sum b/go.sum index a77b420..e3bee4c 100644 --- a/go.sum +++ b/go.sum @@ -77,8 +77,8 @@ github.com/crossplane/crossplane-runtime v1.14.0-rc.0.0.20231011070344-cc691421c github.com/crossplane/crossplane-runtime v1.14.0-rc.0.0.20231011070344-cc691421c2e5/go.mod h1:kCS5576be8g++HhiDGEBUw+8nkW8p4jhURYeC0zx8jM= 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= @@ -315,6 +315,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR 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 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= @@ -359,6 +360,8 @@ 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=