diff --git a/Makefile b/Makefile index 81164f0928..bb9bc1ae5b 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ export SUBPACKAGES := $(SUBPACKAGES) KIND_VERSION = v0.21.0 UP_VERSION = v0.20.0 UP_CHANNEL = stable -UPTEST_VERSION = v0.8.0 +UPTEST_VERSION = v0.11.0 KUSTOMIZE_VERSION = v5.3.0 YQ_VERSION = v4.40.5 diff --git a/config/cloudformation/config.go b/config/cloudformation/config.go index 9970b57f42..55042fd1c9 100644 --- a/config/cloudformation/config.go +++ b/config/cloudformation/config.go @@ -9,8 +9,9 @@ import "github.com/crossplane/upjet/pkg/config" // Configure adds configurations for the cloudformation group. func Configure(p *config.Provider) { p.AddResourceConfigurator("aws_cloudformation_stack_set_instance", func(r *config.Resource) { - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { params["region"] = jsonMap["region"] + return nil } }) } diff --git a/config/ec2/config.go b/config/ec2/config.go index 0af097df7e..668c28423c 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -216,11 +216,12 @@ func Configure(p *config.Provider) { "source_security_group_id", }, } - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { // TODO: Has better be implemented via defaulting. if _, ok := jsonMap["self"]; !ok { params["self"] = false } + return nil } }) @@ -423,12 +424,13 @@ func Configure(p *config.Provider) { r.References["source_ami_id"] = config.Reference{ Type: "AMI", } - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { params["ebs_block_device"] = []any{} // TODO: Has better be implemented via defaulting. if _, ok := jsonMap["encrypted"]; !ok { params["encrypted"] = false } + return nil } r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { if diff != nil && diff.Attributes != nil { diff --git a/config/s3/config.go b/config/s3/config.go index 3178c495cb..5803803e0a 100644 --- a/config/s3/config.go +++ b/config/s3/config.go @@ -42,7 +42,7 @@ func Configure(p *config.Provider) { "logging", "object_lock_configuration", "policy", "replication_configuration", "request_payer", "server_side_encryption_configuration", "versioning", "website", "arn") r.MetaResource.ExternalName = registry.RandRFC1123Subdomain - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { params["region"] = jsonMap["region"] // TODO: added to prevent extra reconciliations due to // late-initialization or drift. Has better be implemented @@ -50,6 +50,7 @@ func Configure(p *config.Provider) { if _, ok := jsonMap["forceDestroy"]; !ok { params["force_destroy"] = false } + return nil } }) @@ -73,11 +74,12 @@ func Configure(p *config.Provider) { r.LateInitializer = config.LateInitializer{ IgnoredFields: []string{"etag", "kms_key_id"}, } - r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(jsonMap map[string]any, params map[string]any) error { // TODO: Has better be implemented via defaulting. if _, ok := jsonMap["acl"]; !ok { params["acl"] = "private" } + return nil } }) diff --git a/config/secretsmanager/config.go b/config/secretsmanager/config.go index 0c0ddb7e63..d4c69eb9f2 100644 --- a/config/secretsmanager/config.go +++ b/config/secretsmanager/config.go @@ -19,8 +19,9 @@ func Configure(p *config.Provider) { //nolint:gocyclo // aws_secretsmanager_secret_policy. config.MoveToStatus(r.TerraformResource, "policy") // TODO: we had better do this for all resources... - r.TerraformConfigurationInjector = func(_ map[string]any, params map[string]any) { + r.TerraformConfigurationInjector = func(_ map[string]any, params map[string]any) error { params["name_prefix"] = "" + return nil } r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, state *terraform.InstanceState, config *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { // skip diff customization on create diff --git a/examples/s3/v1beta1/object.yaml b/examples/s3/v1beta1/object.yaml index c8ba9e0cf8..ceb18387b2 100644 --- a/examples/s3/v1beta1/object.yaml +++ b/examples/s3/v1beta1/object.yaml @@ -3,6 +3,7 @@ kind: Object metadata: annotations: meta.upbound.io/example-id: s3/v1beta1/object + uptest.upbound.io/disable-import: "true" labels: testing.upbound.io/example-name: object name: example-object diff --git a/go.mod b/go.mod index cc07551a42..88e40fede9 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/aws/smithy-go v1.19.0 github.com/crossplane/crossplane-runtime v1.15.0-rc.0.0.20231215091746-d23a82b3a2f5 github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 - github.com/crossplane/upjet v1.1.0 + github.com/crossplane/upjet v1.2.0-rc.0.0.20240214173902-780c97fac125 github.com/go-ini/ini v1.46.0 github.com/google/go-cmp v0.6.0 github.com/hashicorp/terraform-json v0.18.0 diff --git a/go.sum b/go.sum index 042416b374..c603a8b42b 100644 --- a/go.sum +++ b/go.sum @@ -267,8 +267,8 @@ github.com/crossplane/crossplane-runtime v1.15.0-rc.0.0.20231215091746-d23a82b3a github.com/crossplane/crossplane-runtime v1.15.0-rc.0.0.20231215091746-d23a82b3a2f5/go.mod h1:pgt7PaTvvOQz3jILyxbCaeleU9MrAqKaNoPJavhGBgM= 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 v1.1.0 h1:jfdag6qaF1/5mvlDT/8LdTc/vq1Iq0ASnmk3yV86I9U= -github.com/crossplane/upjet v1.1.0/go.mod h1:0bHLtnejZ9bDeyXuBb9MSOQLvKo3+aoTeUBO8N0dGSA= +github.com/crossplane/upjet v1.2.0-rc.0.0.20240214173902-780c97fac125 h1:2ueKn/H9L4LW6tkt0C5+5Ryf4hX0mxiIIucaF/Xr668= +github.com/crossplane/upjet v1.2.0-rc.0.0.20240214173902-780c97fac125/go.mod h1:0bHLtnejZ9bDeyXuBb9MSOQLvKo3+aoTeUBO8N0dGSA= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw=