Skip to content

Commit

Permalink
Fixes for bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
tchinmai7 committed Feb 12, 2024
1 parent 3600285 commit 14a015e
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 90 deletions.
2 changes: 1 addition & 1 deletion apis/objectstorage/v1alpha1/zz_bucket_terraformed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 21 additions & 5 deletions apis/objectstorage/v1alpha1/zz_bucket_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 40 additions & 6 deletions apis/objectstorage/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cluster/test/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ spec:
name: provider-secret
namespace: upbound-system
key: credentials
EOF
12 changes: 10 additions & 2 deletions config/objectstoragebucket/config.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package objectstoragebucket

import "github.com/crossplane/upjet/pkg/config"
import (
"github.com/crossplane/upjet/pkg/config"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// Configure configures individual resources by adding custom ResourceConfigurators.
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",
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/instance/simple-instance.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: instance.linode.upbound.io/v1alpha1
kind: Instance
metadata:
name: test-instance
name: uptest-instance
spec:
forProvider:
image: linode/ubuntu22.04
Expand Down
1 change: 0 additions & 1 deletion examples/resources/objectstorage/bucket.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ metadata:
spec:
deletionPolicy: Orphan
forProvider:
corsEnabled: true
label: test-bucket
cluster: us-sea-1
providerConfigRef:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/linode/terraform-provider-linode/v2 v2.14.0 => github.com/tchinmai7/terraform-provider-linode/v2 v2.0.0-20240209230743-2ac41241b647
replace github.com/linode/terraform-provider-linode/v2 v2.14.0 => github.com/tchinmai7/terraform-provider-linode/v2 v2.0.0-20240212213046-468f25b69508
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tchinmai7/terraform-provider-linode/v2 v2.0.0-20240209230743-2ac41241b647 h1:3ws/71Hmz4NKmrYpDw1YCTOomVQRs2d5xY8h2x9UvzI=
github.com/tchinmai7/terraform-provider-linode/v2 v2.0.0-20240209230743-2ac41241b647/go.mod h1:aBTakKvYrwuKW1rCpFiW2pjvNnVXz3yJqUfDvtFiFOw=
github.com/tchinmai7/terraform-provider-linode/v2 v2.0.0-20240212213046-468f25b69508 h1:u3jh3HD6dHK1AxGDCGVg6uIAXmiGxDCgylaco9n1wX8=
github.com/tchinmai7/terraform-provider-linode/v2 v2.0.0-20240212213046-468f25b69508/go.mod h1:aBTakKvYrwuKW1rCpFiW2pjvNnVXz3yJqUfDvtFiFOw=
github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ=
github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
Expand Down
3 changes: 2 additions & 1 deletion internal/clients/linode.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/linode/provider-linode/apis/v1beta1"

"github.com/linode/terraform-provider-linode/v2/linode"
"github.com/linode/terraform-provider-linode/v2/linode/helper"
"github.com/linode/terraform-provider-linode/v2/version"
)

Expand Down Expand Up @@ -115,7 +116,7 @@ func configureNoForkLinodeclient(ctx context.Context, ps *terraform.Setup, p sch

ps.Meta = p.Meta()

fwProvider := linode.CreateFrameworkProviderWithMeta(version.ProviderVersion, p.Meta())
fwProvider := linode.CreateFrameworkProviderWithMeta(version.ProviderVersion, p.Meta().(*helper.ProviderMeta))
ps.FrameworkProvider = fwProvider
return nil
}
88 changes: 18 additions & 70 deletions package/crds/objectstorage.linode.upbound.io_buckets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,46 +154,15 @@ spec:
description: The cert used by this Object Storage Bucket.
items:
properties:
certificateSecretRef:
certificate:
description: The Base64 encoded and PEM formatted SSL certificate.
The Base64 encoded and PEM formatted SSL certificate.
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:
type: string
privateKey:
description: The private key associated with the TLS/SSL
certificate. The private key associated with the TLS/SSL
certificate.
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: string
type: object
type: array
cluster:
Expand Down Expand Up @@ -457,6 +426,16 @@ spec:
cert:
description: The cert used by this Object Storage Bucket.
items:
properties:
certificate:
description: The Base64 encoded and PEM formatted SSL certificate.
The Base64 encoded and PEM formatted SSL certificate.
type: string
privateKey:
description: The private key associated with the TLS/SSL
certificate. The private key associated with the TLS/SSL
certificate.
type: string
type: object
type: array
cluster:
Expand Down Expand Up @@ -810,46 +789,15 @@ spec:
description: The cert used by this Object Storage Bucket.
items:
properties:
certificateSecretRef:
certificate:
description: The Base64 encoded and PEM formatted SSL certificate.
The Base64 encoded and PEM formatted SSL certificate.
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:
type: string
privateKey:
description: The private key associated with the TLS/SSL
certificate. The private key associated with the TLS/SSL
certificate.
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: string
type: object
type: array
cluster:
Expand Down

0 comments on commit 14a015e

Please sign in to comment.