From c71063dc78e0b08be34e9cbd48fc95b59d664208 Mon Sep 17 00:00:00 2001 From: Steven Borrelli Date: Thu, 12 Dec 2024 11:44:06 +0000 Subject: [PATCH 1/4] add subnet_configuration to VPCEndpoint moveToStatus Signed-off-by: Steven Borrelli (cherry picked from commit 2e473a812b5938ae42dd794d82476c25889fbf60) --- config/ec2/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ec2/config.go b/config/ec2/config.go index ba0b4a2caf..ecac4191e9 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -153,7 +153,7 @@ func Configure(p *config.Provider) { //nolint:gocyclo // aws_vpc_endpoint_subnet_association // aws_vpc_endpoint_route_table_association // aws_vpc_endpoint_security_group_association - config.MoveToStatus(r.TerraformResource, "subnet_ids", "security_group_ids", "route_table_ids") + config.MoveToStatus(r.TerraformResource, "subnet_configuration", "subnet_ids", "security_group_ids", "route_table_ids") delete(r.References, "vpc_endpoint_type") }) From 3d6b359c1b77c5ead8b3bd462aac8f581609aee8 Mon Sep 17 00:00:00 2001 From: Steven Borrelli Date: Thu, 12 Dec 2024 15:25:19 +0000 Subject: [PATCH 2/4] move subnet_configuration to lateInit Signed-off-by: Steven Borrelli (cherry picked from commit fde991a9af4039be63a3961cd0e060cc2f397c9d) --- apis/ec2/v1beta2/zz_vpcendpoint_terraformed.go | 1 + config/ec2/config.go | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/apis/ec2/v1beta2/zz_vpcendpoint_terraformed.go b/apis/ec2/v1beta2/zz_vpcendpoint_terraformed.go index 90091e0619..e0c3c7bbdd 100755 --- a/apis/ec2/v1beta2/zz_vpcendpoint_terraformed.go +++ b/apis/ec2/v1beta2/zz_vpcendpoint_terraformed.go @@ -118,6 +118,7 @@ func (tr *VPCEndpoint) LateInitialize(attrs []byte) (bool, error) { return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") } opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("SubnetConfiguration")) li := resource.NewGenericLateInitializer(opts...) return li.LateInitialize(&tr.Spec.ForProvider, params) diff --git a/config/ec2/config.go b/config/ec2/config.go index ecac4191e9..a15f70eb6d 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -153,7 +153,14 @@ func Configure(p *config.Provider) { //nolint:gocyclo // aws_vpc_endpoint_subnet_association // aws_vpc_endpoint_route_table_association // aws_vpc_endpoint_security_group_association - config.MoveToStatus(r.TerraformResource, "subnet_configuration", "subnet_ids", "security_group_ids", "route_table_ids") + r.LateInitializer = config.LateInitializer{ + // NOTE(muvaf): Conflicts with AvailabilityZone. See the following + // for more details: https://github.com/crossplane/upjet/issues/107 + IgnoredFields: []string{ + "subnet_configuration", + }, + } + config.MoveToStatus(r.TerraformResource, "subnet_ids", "security_group_ids", "route_table_ids") delete(r.References, "vpc_endpoint_type") }) From d1efe47c604d9d2c19c388041d73b453849c88fb Mon Sep 17 00:00:00 2001 From: Steven Borrelli Date: Thu, 12 Dec 2024 17:02:18 +0000 Subject: [PATCH 3/4] add v1beta1 lateInit Signed-off-by: Steven Borrelli (cherry picked from commit 4a5e2194dfb856d0d70dfc6be60fcf8d2b2a3770) --- apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go | 1 + config/ec2/config.go | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go b/apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go index 84cb42d177..90fd341b5c 100755 --- a/apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go +++ b/apis/ec2/v1beta1/zz_vpcendpoint_terraformed.go @@ -118,6 +118,7 @@ func (tr *VPCEndpoint) LateInitialize(attrs []byte) (bool, error) { return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") } opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + opts = append(opts, resource.WithNameFilter("SubnetConfiguration")) li := resource.NewGenericLateInitializer(opts...) return li.LateInitialize(&tr.Spec.ForProvider, params) diff --git a/config/ec2/config.go b/config/ec2/config.go index a15f70eb6d..e9c9eae023 100644 --- a/config/ec2/config.go +++ b/config/ec2/config.go @@ -154,8 +154,7 @@ func Configure(p *config.Provider) { //nolint:gocyclo // aws_vpc_endpoint_route_table_association // aws_vpc_endpoint_security_group_association r.LateInitializer = config.LateInitializer{ - // NOTE(muvaf): Conflicts with AvailabilityZone. See the following - // for more details: https://github.com/crossplane/upjet/issues/107 + // Conflicts with VPCEndpointSubnetAssociation IgnoredFields: []string{ "subnet_configuration", }, From 4412ea27d8e18d9890be21419e881d977bbe35c3 Mon Sep 17 00:00:00 2001 From: Steven Borrelli Date: Fri, 13 Dec 2024 10:02:53 +0000 Subject: [PATCH 4/4] disable uptest import for VPCEndpointSubnetAssociation Signed-off-by: Steven Borrelli (cherry picked from commit 0bc6613bdda2a56d5f00aba61727f09950d8d3bf) --- examples/ec2/v1beta1/vpcendpointsubnetassociation.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/ec2/v1beta1/vpcendpointsubnetassociation.yaml b/examples/ec2/v1beta1/vpcendpointsubnetassociation.yaml index 208c13b041..35c03a2b47 100644 --- a/examples/ec2/v1beta1/vpcendpointsubnetassociation.yaml +++ b/examples/ec2/v1beta1/vpcendpointsubnetassociation.yaml @@ -5,6 +5,8 @@ apiVersion: ec2.aws.upbound.io/v1beta1 kind: VPCEndpointSubnetAssociation metadata: + annotations: + uptest.upbound.io/disable-import: "true" labels: testing.upbound.io/example-name: sn_ec2 name: sn-ec2