Skip to content

Commit

Permalink
Fix Endpoint.dms update loop and make uptestable
Browse files Browse the repository at this point in the history
Signed-off-by: Fatih Türken <[email protected]>
  • Loading branch information
turkenf committed Jan 11, 2024
1 parent 0b7c0ff commit ce6b657
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 54 deletions.
7 changes: 7 additions & 0 deletions config/dms/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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
}
})
}
66 changes: 12 additions & 54 deletions examples/dms/endpoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -99,4 +57,4 @@ metadata:
namespace: upbound-system
type: Opaque
stringData:
example-key: "Upbound!"
example-key: "Upbound!"

0 comments on commit ce6b657

Please sign in to comment.