diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 4aae1d9..bc3aa1b 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -6,7 +6,7 @@ on: jobs: e2e: - uses: upbound/uptest/.github/workflows/pr-comment-trigger.yml@main + uses: upbound/official-providers-ci/.github/workflows/pr-comment-trigger.yml@main secrets: UPTEST_CLOUD_CREDENTIALS: ${{ secrets.UPTEST_CLOUD_CREDENTIALS }} UPTEST_DATASOURCE: ${{ secrets.UPTEST_DATASOURCE }} diff --git a/apis/objectstorage/v1alpha1/zz_bucket_terraformed.go b/apis/objectstorage/v1alpha1/zz_bucket_terraformed.go index 3c0fdd1..96a40c1 100755 --- a/apis/objectstorage/v1alpha1/zz_bucket_terraformed.go +++ b/apis/objectstorage/v1alpha1/zz_bucket_terraformed.go @@ -21,7 +21,7 @@ func (mg *Bucket) GetTerraformResourceType() string { // GetConnectionDetailsMapping for this Bucket func (tr *Bucket) GetConnectionDetailsMapping() map[string]string { - return map[string]string{"secret_key": "secretKeySecretRef"} + return map[string]string{"cert[*].certificate": "cert[*].certificateSecretRef", "cert[*].private_key": "cert[*].privateKeySecretRef", "secret_key": "secretKeySecretRef"} } // GetObservation of this Bucket diff --git a/apis/objectstorage/v1alpha1/zz_bucket_types.go b/apis/objectstorage/v1alpha1/zz_bucket_types.go index 898b6f2..3e2609b 100755 --- a/apis/objectstorage/v1alpha1/zz_bucket_types.go +++ b/apis/objectstorage/v1alpha1/zz_bucket_types.go @@ -85,7 +85,7 @@ type BucketObservation struct { AccessKey *string `json:"accessKey,omitempty" tf:"access_key,omitempty"` // The cert used by this Object Storage Bucket. - Cert []CertObservation `json:"cert,omitempty" tf:"cert,omitempty"` + Cert []CertParameters `json:"cert,omitempty" tf:"cert,omitempty"` // (Deprecated) The cluster of the Linode Object Storage Bucket. This is deprecated in favor of region attribute. // For example, us-mia-1 cluster can be translated into us-mia region. Exactly one of region and cluster is required for creating a bucket. @@ -206,22 +206,14 @@ type CertInitParameters struct { // The Base64 encoded and PEM formatted SSL certificate. // The Base64 encoded and PEM formatted SSL certificate. - Certificate *string `json:"certificate,omitempty" tf:"certificate,omitempty"` + CertificateSecretRef v1.SecretKeySelector `json:"certificateSecretRef" tf:"-"` // The private key associated with the TLS/SSL certificate. // The private key associated with the TLS/SSL certificate. - PrivateKey *string `json:"privateKey,omitempty" tf:"private_key,omitempty"` + PrivateKeySecretRef v1.SecretKeySelector `json:"privateKeySecretRef" tf:"-"` } type CertObservation struct { - - // The Base64 encoded and PEM formatted SSL certificate. - // The Base64 encoded and PEM formatted SSL certificate. - Certificate *string `json:"certificate,omitempty" tf:"certificate,omitempty"` - - // The private key associated with the TLS/SSL certificate. - // The private key associated with the TLS/SSL certificate. - PrivateKey *string `json:"privateKey,omitempty" tf:"private_key,omitempty"` } type CertParameters struct { @@ -229,12 +221,12 @@ type CertParameters struct { // The Base64 encoded and PEM formatted SSL certificate. // The Base64 encoded and PEM formatted SSL certificate. // +kubebuilder:validation:Optional - Certificate *string `json:"certificate" tf:"certificate,omitempty"` + CertificateSecretRef v1.SecretKeySelector `json:"certificateSecretRef" tf:"-"` // The private key associated with the TLS/SSL certificate. // The private key associated with the TLS/SSL certificate. // +kubebuilder:validation:Optional - PrivateKey *string `json:"privateKey" tf:"private_key,omitempty"` + PrivateKeySecretRef v1.SecretKeySelector `json:"privateKeySecretRef" tf:"-"` } type ExpirationInitParameters struct { diff --git a/apis/objectstorage/v1alpha1/zz_generated.deepcopy.go b/apis/objectstorage/v1alpha1/zz_generated.deepcopy.go index bf04f46..76122d5 100644 --- a/apis/objectstorage/v1alpha1/zz_generated.deepcopy.go +++ b/apis/objectstorage/v1alpha1/zz_generated.deepcopy.go @@ -171,9 +171,7 @@ func (in *BucketInitParameters) DeepCopyInto(out *BucketInitParameters) { if in.Cert != nil { in, out := &in.Cert, &out.Cert *out = make([]CertInitParameters, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } if in.Cluster != nil { in, out := &in.Cluster, &out.Cluster @@ -281,10 +279,8 @@ func (in *BucketObservation) DeepCopyInto(out *BucketObservation) { } if in.Cert != nil { in, out := &in.Cert, &out.Cert - *out = make([]CertObservation, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + *out = make([]CertParameters, len(*in)) + copy(*out, *in) } if in.Cluster != nil { in, out := &in.Cluster, &out.Cluster @@ -381,9 +377,7 @@ func (in *BucketParameters) DeepCopyInto(out *BucketParameters) { if in.Cert != nil { in, out := &in.Cert, &out.Cert *out = make([]CertParameters, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } + copy(*out, *in) } if in.Cluster != nil { in, out := &in.Cluster, &out.Cluster @@ -482,16 +476,8 @@ func (in *BucketStatus) DeepCopy() *BucketStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CertInitParameters) DeepCopyInto(out *CertInitParameters) { *out = *in - if in.Certificate != nil { - in, out := &in.Certificate, &out.Certificate - *out = new(string) - **out = **in - } - if in.PrivateKey != nil { - in, out := &in.PrivateKey, &out.PrivateKey - *out = new(string) - **out = **in - } + out.CertificateSecretRef = in.CertificateSecretRef + out.PrivateKeySecretRef = in.PrivateKeySecretRef } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertInitParameters. @@ -507,16 +493,6 @@ func (in *CertInitParameters) DeepCopy() *CertInitParameters { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CertObservation) DeepCopyInto(out *CertObservation) { *out = *in - if in.Certificate != nil { - in, out := &in.Certificate, &out.Certificate - *out = new(string) - **out = **in - } - if in.PrivateKey != nil { - in, out := &in.PrivateKey, &out.PrivateKey - *out = new(string) - **out = **in - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertObservation. @@ -532,16 +508,8 @@ func (in *CertObservation) DeepCopy() *CertObservation { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CertParameters) DeepCopyInto(out *CertParameters) { *out = *in - if in.Certificate != nil { - in, out := &in.Certificate, &out.Certificate - *out = new(string) - **out = **in - } - if in.PrivateKey != nil { - in, out := &in.PrivateKey, &out.PrivateKey - *out = new(string) - **out = **in - } + out.CertificateSecretRef = in.CertificateSecretRef + out.PrivateKeySecretRef = in.PrivateKeySecretRef } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertParameters. diff --git a/config/objectstoragebucket/config.go b/config/objectstoragebucket/config.go index fb80e08..7895e99 100644 --- a/config/objectstoragebucket/config.go +++ b/config/objectstoragebucket/config.go @@ -2,7 +2,6 @@ package objectstoragebucket import ( "github.com/crossplane/upjet/pkg/config" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) // Configure configures individual resources by adding custom ResourceConfigurators. @@ -10,12 +9,6 @@ func Configure(p *config.Provider) { p.AddResourceConfigurator("linode_object_storage_bucket", func(r *config.Resource) { r.ShortGroup = "objectstorage" r.Kind = "Bucket" - element, ok := r.TerraformResource.Schema["cert"].Elem.(*schema.Resource) - if ok { - element.Schema["certificate"].Sensitive = false - element.Schema["private_key"].Sensitive = false - } - r.References["access_key"] = config.Reference{ Type: "Key", RefFieldName: "AccessKeyRef", diff --git a/package/crds/objectstorage.linode.upbound.io_buckets.yaml b/package/crds/objectstorage.linode.upbound.io_buckets.yaml index aade23d..0f46208 100644 --- a/package/crds/objectstorage.linode.upbound.io_buckets.yaml +++ b/package/crds/objectstorage.linode.upbound.io_buckets.yaml @@ -161,16 +161,44 @@ spec: description: The cert used by this Object Storage Bucket. items: properties: - certificate: + certificateSecretRef: description: |- The Base64 encoded and PEM formatted SSL certificate. The Base64 encoded and PEM formatted SSL certificate. - type: string - privateKey: + properties: + key: + description: The key to select. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - key + - name + - namespace + type: object + privateKeySecretRef: description: |- The private key associated with the TLS/SSL certificate. The private key associated with the TLS/SSL certificate. - type: string + properties: + key: + description: The key to select. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - key + - name + - namespace + type: object type: object type: array cluster: @@ -389,16 +417,47 @@ spec: description: The cert used by this Object Storage Bucket. items: properties: - certificate: + certificateSecretRef: description: |- The Base64 encoded and PEM formatted SSL certificate. The Base64 encoded and PEM formatted SSL certificate. - type: string - privateKey: + properties: + key: + description: The key to select. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - key + - name + - namespace + type: object + privateKeySecretRef: description: |- The private key associated with the TLS/SSL certificate. The private key associated with the TLS/SSL certificate. - type: string + properties: + key: + description: The key to select. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - key + - name + - namespace + type: object + required: + - certificateSecretRef + - privateKeySecretRef type: object type: array cluster: @@ -707,16 +766,44 @@ spec: description: The cert used by this Object Storage Bucket. items: properties: - certificate: + certificateSecretRef: description: |- The Base64 encoded and PEM formatted SSL certificate. The Base64 encoded and PEM formatted SSL certificate. - type: string - privateKey: + properties: + key: + description: The key to select. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - key + - name + - namespace + type: object + privateKeySecretRef: description: |- The private key associated with the TLS/SSL certificate. The private key associated with the TLS/SSL certificate. - type: string + properties: + key: + description: The key to select. + type: string + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - key + - name + - namespace + type: object type: object type: array cluster: