diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 1fdc8c62..2e53a7e0 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,5 +1,5 @@ ack_generate_info: - build_date: "2024-09-12T18:02:26Z" + build_date: "2024-09-17T17:53:28Z" build_hash: f8f98563404066ac3340db0a049d2e530e5c51cc go_version: go1.22.6 version: v0.38.1 diff --git a/pkg/resource/route_table/sdk.go b/pkg/resource/route_table/sdk.go index b66be1ec..d9610f05 100644 --- a/pkg/resource/route_table/sdk.go +++ b/pkg/resource/route_table/sdk.go @@ -234,6 +234,20 @@ func (rm *resourceManager) sdkFind( // then assign resource's tags to maintain tag order ko.Spec.Tags = r.ko.Spec.Tags } + + // Even if route is created with arguments as VPCEndpointID, + // when aws api is called to describe the route (inside skdFind), it + // returns VPCEndpointID as GatewayID. Due to this bug, spec section for + // routes is populated incorrectly in above auto-gen code. + // To solve this, if 'GatewayID' has prefix 'vpce-', then the entry is + // moved from 'GatewayID' to 'VPCEndpointID'. + for i, route := range ko.Spec.Routes { + if route.GatewayID != nil && strings.HasPrefix(*route.GatewayID, "vpce-") { + ko.Spec.Routes[i].VPCEndpointID = route.GatewayID + ko.Spec.Routes[i].GatewayID = nil + } + } + return &resource{ko}, nil } diff --git a/templates/hooks/route_table/sdk_read_many_post_set_output.go.tpl b/templates/hooks/route_table/sdk_read_many_post_set_output.go.tpl index a604f5a3..2c613fbd 100644 --- a/templates/hooks/route_table/sdk_read_many_post_set_output.go.tpl +++ b/templates/hooks/route_table/sdk_read_many_post_set_output.go.tpl @@ -7,4 +7,17 @@ // if resource's initial tags and response tags are equal, // then assign resource's tags to maintain tag order ko.Spec.Tags = r.ko.Spec.Tags - } \ No newline at end of file + } + + // Even if route is created with arguments as VPCEndpointID, + // when aws api is called to describe the route (inside skdFind), it + // returns VPCEndpointID as GatewayID. Due to this bug, spec section for + // routes is populated incorrectly in above auto-gen code. + // To solve this, if 'GatewayID' has prefix 'vpce-', then the entry is + // moved from 'GatewayID' to 'VPCEndpointID'. + for i, route := range ko.Spec.Routes { + if route.GatewayID != nil && strings.HasPrefix(*route.GatewayID, "vpce-") { + ko.Spec.Routes[i].VPCEndpointID = route.GatewayID + ko.Spec.Routes[i].GatewayID = nil + } + }