Skip to content

Add remaining VPCLattice resources and related examples - #1874

Merged
sergenyalcin merged 12 commits into
crossplane-contrib:mainfrom
mirrajabi:main
Oct 23, 2025
Merged

Add remaining VPCLattice resources and related examples#1874
sergenyalcin merged 12 commits into
crossplane-contrib:mainfrom
mirrajabi:main

Conversation

@mirrajabi

@mirrajabi mirrajabi commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Description of your changes

This PR adds the missing VPC Lattice resources and examples for each.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make generate and committed the results (ideally in a separate commit).
  • Not made any manual changes to generated files, and verified this with make check-diff.

How has this code been tested

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@mirrajabi

mirrajabi commented Oct 1, 2025

Copy link
Copy Markdown
Contributor Author

Dear maintainers,

@turkenf
@mbbush
@jastang
@sergenyalcin

Could you review and trigger the tests for these resources, please?

  • aws_vpclattice_service_network_resource_association
  • aws_vpclattice_access_log_subscription
  • aws_vpclattice_auth_policy
  • aws_vpclattice_listener_rule
  • aws_vpclattice_resource_policy
  • aws_vpclattice_service_network_service_association
  • aws_vpclattice_service_network_vpc_association
  • aws_vpclattice_target_group_attachment

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/accesslogsubscription.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/authpolicy.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/listenerrule.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkresourceassociation.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkserviceassociation.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkvpcassociation.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkvpcassociation.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkserviceassociation.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkresourceassociation.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/listenerrule.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/authpolicy.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/accesslogsubscription.yaml"

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@mirrajabi

Copy link
Copy Markdown
Contributor Author

@jeanduplessis Thanks for triggering the tests, I've tried a few blind fixes which I couldn't easily test locally myself. Could you please re-trigger them?

On some issues I have no idea tbh! Below aren't fixed yet. Any clues?

Are the runs completely isolated or is it possible that duplicate resources in two tests conflict and race against each other?

@turkenf

turkenf commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/accesslogsubscription.yaml"

@turkenf

turkenf commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/authpolicy.yaml"

@turkenf

turkenf commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/listenerrule.yaml"

@turkenf

turkenf commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkresourceassociation.yaml"

@turkenf

turkenf commented Oct 13, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/listenerrule.yaml"

@turkenf

turkenf commented Oct 13, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/servicenetworkresourceassociation.yaml"

@turkenf

turkenf commented Oct 13, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"

@turkenf

turkenf commented Oct 13, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@mirrajabi

Copy link
Copy Markdown
Contributor Author

@turkenf Could you retrigger for the following, please?

  • /test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"
  • /test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"
  • /test-examples="examples/vpclattice/cluster/v1beta1/listenerrule.yaml"

Hopefully, this would be the last fix. Unfortunately, I haven't yet set up local testing yet which means I solely rely on CI test for now. I'll set that up before I start with next PRs.

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"

@jeanduplessis

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/listenerrule.yaml"

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@mirrajabi

Copy link
Copy Markdown
Contributor Author

@jeanduplessis @turkenf I believe 847b8c9 should fix the aws_vpclattice_resource_policy (could you retry that one, please?)

This leaves only the broken target-group-attachement failure which is beyond any reasoning. Could you have a look at this one, please? https://github.com/crossplane-contrib/provider-upjet-aws/actions/runs/18631722158/job/53117376685

I'm hitting a deadline so I might have to just ditch the TargetGroupAttachment in this PR if it's not easily fixable.

@turkenf

turkenf commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

@turkenf

turkenf commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"

@mirrajabi

Copy link
Copy Markdown
Contributor Author

@turkenf I think the pipelines are failing now due to AWS outage in us-east-1 region. https://health.aws.amazon.com/health/status 🤦

@turkenf

turkenf commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"

@turkenf

turkenf commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@turkenf

turkenf commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
…rkReadWrite

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@sergenyalcin

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

@sergenyalcin

Copy link
Copy Markdown
Collaborator

Hi @mirrajabi I just reviewed the PR and saw the failing tests for two resources. In locally, I have figured out the problems in the example manifests and one reference generation in the TargetGroupAttachment resource. Let me share my findings:

The successful example manifests for the ResourcePolicy is here. I changed the policy field:

Cluster-Scoped:

# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: vpclattice.aws.upbound.io/v1beta1
kind: ResourcePolicy
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/resourcepolicy
  labels:
    testing.upbound.io/example-name: example
  name: example
spec:
  forProvider:
    policy: |
      {
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Principal":{
              "AWS":"arn:aws:iam::153891904029:root"
            },
            "Action": [
              "vpc-lattice:GetServiceNetwork",
              "vpc-lattice:CreateServiceNetworkResourceAssociation",
              "vpc-lattice:CreateServiceNetworkServiceAssociation",
              "vpc-lattice:CreateServiceNetworkVpcAssociation",
              "vpc-lattice:CreateServiceNetworkVpcEndpointAssociation"
            ]
          }
        ]
      }
    region: us-west-1
    resourceArnSelector:
      matchLabels:
        testing.upbound.io/example-name: example

---

apiVersion: vpclattice.aws.upbound.io/v1beta1
kind: ServiceNetwork
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/resourcepolicy
  labels:
    testing.upbound.io/example-name: example
  name: example
spec:
  forProvider:
    name: example-vpclattice-service-network
    region: us-west-1

Namespaced:

# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: vpclattice.aws.m.upbound.io/v1beta1
kind: ResourcePolicy
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/resourcepolicy
  labels:
    testing.upbound.io/example-name: example
  name: example
  namespace: upbound-system
spec:
  forProvider:
    policy: |
      {
        "Version": "2012-10-17",
        "Statement": [
          {
            "Effect": "Allow",
            "Principal":{
              "AWS":"arn:aws:iam::153891904029:root"
            },
            "Action": [
              "vpc-lattice:GetServiceNetwork",
              "vpc-lattice:CreateServiceNetworkResourceAssociation",
              "vpc-lattice:CreateServiceNetworkServiceAssociation",
              "vpc-lattice:CreateServiceNetworkVpcAssociation",
              "vpc-lattice:CreateServiceNetworkVpcEndpointAssociation"
            ]
          }
        ]
      }
    region: us-west-1
    resourceArnSelector:
      matchLabels:
        testing.upbound.io/example-name: example

---

apiVersion: vpclattice.aws.m.upbound.io/v1beta1
kind: ServiceNetwork
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/resourcepolicy
  labels:
    testing.upbound.io/example-name: example
  name: example
  namespace: upbound-system
spec:
  forProvider:
    name: example-vpclattice-service-network
    region: us-west-1

For TargetGroupAttachment resource, firstly I have a comment about the refernced field target.id. upjet has an automated tool to catch refernce fields from TF registry examples. In TF side some fields can refer more than one kind like LB, Instance etc. Here we have the same situation. This target.id field can refer to more than one different resources like LB, Instance, Lambda. However the example in the TF registry contains the LB one: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpclattice_target_group_attachment#basic-usage

In these type of situations, in upjet-based providers, we are removing the reference generation/field since not connecting this field to just a one resource. An example:

delete(r.References, "resource_arn")

So here is the correct convention removing the reference from this target.id field and the users directly pass the id of the corresponded resource to target.id field without use of reference. The configuration statement must be like:

delete(r.References, "target.id")

Let's continue with running example manifest. Since the generated example also refers to this one. If I understand correctly, for TargetGroupAttachment, first we need a ALB typed TargetGroup (not INSTANCE typed) and also refer to application LB resource. The configuration seems a bit complex for the LB usage.

So, I tried to make an attachment to a Instance field in my local and it worked:

Cluster-Scoped:

# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: vpclattice.aws.upbound.io/v1beta1
kind: TargetGroupAttachment
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/targetgroupattachment
  labels:
    testing.upbound.io/example-name: example
  name: example
spec:
  forProvider:
    region: us-west-1
    target:
      id: i-04a354440b0289895 # long-running instance
      port: 80
    targetGroupIdentifierSelector:
      matchLabels:
        testing.upbound.io/example-name: example
---
apiVersion: vpclattice.aws.upbound.io/v1beta1
kind: TargetGroup
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/targetgroupattachment
  labels:
    testing.upbound.io/example-name: example
  name: example
spec:
  forProvider:
    config:
      port: 443
      protocol: HTTPS
      vpcIdentifier: vpc-0a388e462a64e3e56 # default VPC
    name: example
    region: us-west-1
    type: INSTANCE

Namespaced:

# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
#
# SPDX-License-Identifier: CC0-1.0

apiVersion: vpclattice.aws.m.upbound.io/v1beta1
kind: TargetGroupAttachment
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/targetgroupattachment
  labels:
    testing.upbound.io/example-name: example
  name: example
  namespace: upbound-system
spec:
  forProvider:
    region: us-west-1
    target:
      id: i-04a354440b0289895 # long-running instance
      port: 80
    targetGroupIdentifierSelector:
      matchLabels:
        testing.upbound.io/example-name: example
---
apiVersion: vpclattice.aws.m.upbound.io/v1beta1
kind: TargetGroup
metadata:
  annotations:
    meta.upbound.io/example-id: vpclattice/v1beta1/targetgroupattachment
  labels:
    testing.upbound.io/example-name: example
  name: example
  namespace: upbound-system
spec:
  forProvider:
    config:
      port: 443
      protocol: HTTPS
      vpcIdentifier: vpc-0a388e462a64e3e56 # default VPC
    name: example
    region: us-west-1
    type: INSTANCE

If there is any unclear point, please ping me. Thanks in advance for considering them.

Signed-off-by: Mad Mirrajabi <mohammadmirrajabi@gmail.com>
@mirrajabi

Copy link
Copy Markdown
Contributor Author

Thanks a lot @sergenyalcin for the clear explanation! I've committed your suggestions.

@sergenyalcin

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/resourcepolicy.yaml"

@sergenyalcin

Copy link
Copy Markdown
Collaborator

/test-examples="examples/vpclattice/cluster/v1beta1/targetgroupattachment.yaml"

@sergenyalcin sergenyalcin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirrajabi, Thank you very much for your effort on this PR, LGTM!

@sergenyalcin
sergenyalcin merged commit 12b307a into crossplane-contrib:main Oct 23, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants