From ce6b657f3653f649f235f04cb417824795e7321e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Thu, 11 Jan 2024 22:57:16 +0300 Subject: [PATCH] Fix Endpoint.dms update loop and make uptestable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fatih Türken --- config/dms/config.go | 7 ++++ examples/dms/endpoint.yaml | 66 +++++++------------------------------- 2 files changed, 19 insertions(+), 54 deletions(-) diff --git a/config/dms/config.go b/config/dms/config.go index 240d9dde99..0e1e42d022 100644 --- a/config/dms/config.go +++ b/config/dms/config.go @@ -6,6 +6,7 @@ package dms import ( "github.com/crossplane/upjet/pkg/config" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/upbound/provider-aws/config/common" ) @@ -27,5 +28,11 @@ func Configure(p *config.Provider) { Extractor: common.PathARNExtractor, }, } + r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { + if diff != nil && diff.Attributes != nil { + delete(diff.Attributes, "redshift_settings.#") + } + return diff, nil + } }) } diff --git a/examples/dms/endpoint.yaml b/examples/dms/endpoint.yaml index 73d28d6791..af88517787 100644 --- a/examples/dms/endpoint.yaml +++ b/examples/dms/endpoint.yaml @@ -2,19 +2,19 @@ apiVersion: dms.aws.upbound.io/v1beta1 kind: Endpoint metadata: annotations: - upjet.upbound.io/manual-intervention: "This resource needs a valid certificateArn and kmsKeyArn values." meta.upbound.io/example-id: dms/v1beta1/endpoint labels: testing.upbound.io/example-name: test - name: test + name: test-endpoint spec: forProvider: - certificateArn: arn:aws:dms:us-west-1:153891904029:cert:OAICKOMTUVHLH2DBBL6EVMTVC65ZUW4H2EGJXVQ databaseName: test endpointType: source engineName: aurora extraConnectionAttributes: "" - kmsKeyArn: arn:aws:kms:us-west-1:153891904029:key/1d738fcd-5e55-4636-8ac0-38806637f050 + kmsKeyArnSelector: + matchLabels: + testing.upbound.io/example-name: example-endpoint passwordSecretRef: key: example-key name: endpoint-secret @@ -26,68 +26,26 @@ spec: tags: Name: test username: test + + --- -apiVersion: dms.aws.upbound.io/v1beta1 -kind: Certificate -metadata: - annotations: - meta.upbound.io/example-id: dms/v1beta1/endpoint - labels: - testing.upbound.io/example-name: test - name: test -spec: - forProvider: - certificatePemSecretRef: - key: example-key - name: example-secret - namespace: upbound-system - region: us-west-1 - tags: - Name: test ---- -apiVersion: v1 -kind: Secret -metadata: - annotations: - meta.upbound.io/example-id: dms/v1beta1/endpoint - labels: - testing.upbound.io/example-name: secret-version - name: example-secret - namespace: upbound-system -type: Opaque -stringData: - example-key: | - -----BEGIN ENCRYPTED PRIVATE KEY----- - MIICljCCAX4CCQCaPK30HegP7TANBgkqhkiG9w0BAQsFADANMQswCQYDVQQGEwJk - ZTAeFw0yMjEyMDYyMTE3MzNaFw0zMjEyMDMyMTE3MzNaMA0xCzAJBgNVBAYTAmRl - MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtnxiilFOwyrYBYcu6HYe - 3L5B2tC3Q9GqwBfIniPCONgPhzb/vpFXqra0uwi0HI1DI52pzCxB4cbj6i74MMX1 - i6KwaiRS+bFhEHflFXcuU2c4OkLsTx8LhGXMJoVhsP6DDUTzoT1/GEfATc2K4Xxn - 0pfRkswE6ZScQ81fodqIZTzcCGOW/2a+GQiR45aePihZVDBugDlN0KZdyQvXOs5H - EE2DwfP1s1GB2MeA+uZBBxNjWj5vKAyCKGrhKgF+jDHN6OX4/SgpOnhWDqqrVeQE - aYsbPfHEfRd6aXPf8b6PvbPRr4FG+MR3qwwqQudmhD44YIW2qj9XlgU2a0ZnG9p4 - PwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBHCBQvmq3T8vK7BES5AF15MF83y3oB - jsjRXGhVy/auUSKYwCd8Oji5QJL+drQddk+Z/mRd5EFeiBqbUUiK6I4ArAzamE8u - VppNsVDMwepqcQafSzu8wm4/zI2PFHp2G4cUjz9jH85C6vEbOGt8m8T2hrRbG/Wr - FIRgJl2RYX4FNkJJ/dpxomPkWc+hIt59YFUrNqf0dubRxZuUYA8iC5a40tA5Fqaq - 0LSvK5UbE0BoD9HEcFP+duwp+8ZE1dOWY11TnkUkLLd9klgxepyMjyEoInetsHxT - Jkwjr/Q/rTbKQwInAY9P/IOundWd7lknL8V/y1CB6awl//r6K/WBybEp - -----END ENCRYPTED PRIVATE KEY----- ---- + apiVersion: kms.aws.upbound.io/v1beta1 kind: Key metadata: annotations: meta.upbound.io/example-id: dms/v1beta1/endpoint labels: - testing.upbound.io/example-name: example - name: example + testing.upbound.io/example-name: example-endpoint + name: example-endpoint spec: forProvider: deletionWindowInDays: 7 description: KMS Key region: us-west-1 + --- + apiVersion: v1 kind: Secret metadata: @@ -99,4 +57,4 @@ metadata: namespace: upbound-system type: Opaque stringData: - example-key: "Upbound!" \ No newline at end of file + example-key: "Upbound!"