Skip to content

fix: ignore diff for trailing dots in Record.route53 names - #1877

Merged
erhancagirici merged 3 commits into
crossplane-contrib:mainfrom
erhancagirici:ignore-diff-route53-cname-trailing-dots
Oct 9, 2025
Merged

fix: ignore diff for trailing dots in Record.route53 names#1877
erhancagirici merged 3 commits into
crossplane-contrib:mainfrom
erhancagirici:ignore-diff-route53-cname-trailing-dots

Conversation

@erhancagirici

@erhancagirici erhancagirici commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

Description of your changes

In Record.route53 resources, spec.forProvider.name accepts both foo.example.org. and foo.example.org. (with trailing dot) and they are semantically equal. However, upstream TF provider always store these in the state without trailing dots. This causes unnecessary diff when the configuration value has a trailing dot.

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

Uptest failed due to a webhook issue, manually tested #1877 (comment)

Signed-off-by: Erhan Cagirici <erhan@upbound.io>
@erhancagirici
erhancagirici force-pushed the ignore-diff-route53-cname-trailing-dots branch from 7e8d0d7 to 97af66d Compare October 8, 2025 15:38
@turkenf

turkenf commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

Manual test:

  1. Create the Route53 record with deletionPolicy: Orphan
apiVersion: route53.aws.upbound.io/v1beta1
kind: Record
metadata:
  name: example
spec:
  deletionPolicy: Orphan
  forProvider:
    name: www.mycompany.test.
    records:
    - "dev.upbound.io"
    ttl: 5
    type: CNAME
    zoneId: Z07016181LMZWWQUWB1ZB
  1. After the resource is created successfully, delete the resource from the cluster.
  2. Then apply the following YAML to import it:
apiVersion: route53.aws.upbound.io/v1beta1
kind: Record
metadata:
  name: example
  annotations:
    crossplane.io/external-name: Z07016181LMZWWQUWB1ZB_www.mycompany.test._CNAME
spec:
  forProvider:
    name: www.mycompany.test.
    records:
    - "dev.upbound.io"
    type: CNAME
    zoneId: Z07016181LMZWWQUWB1ZB

Without this fix, you see the following error:

  - lastTransitionTime: "2025-10-09T11:00:56Z"
    message: 'update failed: async update failed: refuse to update the external resource
      because the following update requires replacing it: cannot change the value
      of the argument "name" from "www.mycompany.test." to "www.mycompany.test"'
    reason: ReconcileError
    status: "False"
    type: Synced

With this fix, the resource was successfully imported:

  conditions:
  - lastTransitionTime: "2025-10-09T11:12:46Z"
    observedGeneration: 2
    reason: ReconcileSuccess
    status: "True"
    type: Synced
  - lastTransitionTime: "2025-10-09T11:11:22Z"
    reason: Success
    status: "True"
    type: LastAsyncOperation
  - lastTransitionTime: "2025-10-09T11:11:22Z"
    reason: Available
    status: "True"
    type: Ready
  - lastTransitionTime: "2025-10-09T11:12:46Z"
    reason: UpToDate
    status: "True"
    type: Test

…ts name

Signed-off-by: Fatih Türken <turkenf@gmail.com>
@turkenf

turkenf commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/route53/cluster/v1beta1/record-with-dot.yaml"

@turkenf

turkenf commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/route53/cluster/v1beta1/record.yaml"

@turkenf

turkenf commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/s3/cluster/v1beta1/bucket.yaml"

@turkenf

turkenf commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/route53/cluster/v1beta1/record.yaml"

Signed-off-by: Fatih Türken <turkenf@gmail.com>
@turkenf

turkenf commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/route53/cluster/v1beta1/record-with-dot.yaml"

1 similar comment
@turkenf

turkenf commented Oct 9, 2025

Copy link
Copy Markdown
Collaborator

/test-examples="examples/route53/cluster/v1beta1/record-with-dot.yaml"

@turkenf turkenf 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.

Thank you @erhancagirici 🙌

@erhancagirici
erhancagirici merged commit 761171b into crossplane-contrib:main Oct 9, 2025
8 of 9 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.

2 participants