Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElastiCache ReplicationGroup auth token generation and connection details #1322

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ElastiCache ReplicationGroup - Fix annotations, selectors in example,…
… error handling

From code review

Signed-off-by: Carl Henrik Lunde <[email protected]>
chlunde committed Jun 6, 2024
commit 2f905a6a79baf10c344e7085d7aa6cae3e85ed5d
10 changes: 7 additions & 3 deletions config/elasticache/config.go
Original file line number Diff line number Diff line change
@@ -7,15 +7,15 @@ package elasticache
import (
"fmt"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/pkg/errors"

xpresource "github.com/crossplane/crossplane-runtime/pkg/resource"
"github.com/crossplane/upjet/pkg/config"
"github.com/crossplane/upjet/pkg/config/conversion"
"github.com/crossplane/upjet/pkg/types/comments"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"

"github.com/upbound/provider-aws/apis/elasticache/v1beta1"
"github.com/upbound/provider-aws/apis/elasticache/v1beta2"
"github.com/upbound/provider-aws/config/common"
@@ -77,9 +77,13 @@ func Configure(p *config.Provider) { //nolint:gocyclo
}

// Auth token generation
desc, _ := comments.New("If true, the auth token will be auto-generated and"+
desc, err := comments.New("If true, the auth token will be auto-generated and"+
" stored in the Secret referenced by the authTokenSecretRef field.",
comments.WithTFTag("-"))
if err != nil {
panic(errors.Wrap(err, "cannot configure the generated comment for the auto_generate_auth_token argument of the aws_elasticache_replication_group resource"))
}

r.TerraformResource.Schema["auto_generate_auth_token"] = &schema.Schema{
Type: schema.TypeBool,
Optional: true,
37 changes: 23 additions & 14 deletions examples/elasticache/v1beta2/replicationgroup.yaml
Original file line number Diff line number Diff line change
@@ -5,21 +5,25 @@
apiVersion: elasticache.aws.upbound.io/v1beta1
kind: SubnetGroup
metadata:
chlunde marked this conversation as resolved.
Show resolved Hide resolved
annotations:
meta.upbound.io/example-id: elasticache/v1beta2/replicationgroup
labels:
testing.upbound.io/example-name: bar
testing.upbound.io/example-name: replicationgroup
name: subnet-group
spec:
forProvider:
region: us-east-1
subnetIdRefs:
- name: foo-1a
- name: foo-1b
subnetIdSelector:
matchLabels:
testing.upbound.io/example-name: replicationgroup
---
apiVersion: ec2.aws.upbound.io/v1beta1
kind: Subnet
metadata:
annotations:
meta.upbound.io/example-id: elasticache/v1beta2/replicationgroup
labels:
testing.upbound.io/example-name: foo
testing.upbound.io/example-name: replicationgroup
name: foo-1a
spec:
forProvider:
@@ -28,13 +32,15 @@ spec:
region: us-east-1
vpcIdSelector:
matchLabels:
testing.upbound.io/example-name: foo
testing.upbound.io/example-name: replicationgroup
---
apiVersion: ec2.aws.upbound.io/v1beta1
kind: Subnet
metadata:
annotations:
meta.upbound.io/example-id: elasticache/v1beta2/replicationgroup
labels:
testing.upbound.io/example-name: foo
testing.upbound.io/example-name: replicationgroup
name: foo-1b
spec:
forProvider:
@@ -43,13 +49,15 @@ spec:
region: us-east-1
vpcIdSelector:
matchLabels:
testing.upbound.io/example-name: foo
testing.upbound.io/example-name: replicationgroup
---
apiVersion: ec2.aws.upbound.io/v1beta1
kind: VPC
metadata:
annotations:
meta.upbound.io/example-id: elasticache/v1beta2/replicationgroup
labels:
testing.upbound.io/example-name: foo
testing.upbound.io/example-name: replicationgroup
name: foo
spec:
forProvider:
@@ -60,7 +68,7 @@ apiVersion: elasticache.aws.upbound.io/v1beta2
kind: ReplicationGroup
metadata:
chlunde marked this conversation as resolved.
Show resolved Hide resolved
annotations:
meta.upbound.io/example-id: elasticache/v1beta1/replicationgroup
meta.upbound.io/example-id: elasticache/v1beta2/replicationgroup
uptest.upbound.io/timeout: "3600"
labels:
testing.upbound.io/example-name: example
@@ -72,7 +80,7 @@ spec:
autoGenerateAuthToken: true
authTokenSecretRef:
name: redis-auth-token
namespace: crossplane-system
namespace: upbound-system
key: auth-token
description: example description
maintenanceWindow: sun:05:00-sun:09:00
@@ -81,12 +89,13 @@ spec:
transitEncryptionEnabled: true
parameterGroupName: default.redis7
port: 6379
subnetGroupNameRef:
name: subnet-group
subnetGroupNameSelector:
matchLabels:
testing.upbound.io/example-name: replicationgroup
preferredCacheClusterAzs:
- us-east-1a
- us-east-1b
region: us-east-1
writeConnectionSecretToRef:
name: redis-conn
namespace: crossplane-system
namespace: upbound-system