Skip to content

Commit 9b64986

Browse files
committed
update examples for aws and gcp
1 parent 4d3b6d8 commit 9b64986

File tree

20 files changed

+374
-73
lines changed

20 files changed

+374
-73
lines changed

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,8 @@ No requirements.
6464

6565
| Name | Version |
6666
|------|---------|
67-
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
68-
| <a name="provider_google"></a> [google](#provider\_google) | n/a |
6967
| <a name="provider_helm"></a> [helm](#provider\_helm) | n/a |
7068
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | n/a |
71-
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
7269

7370
## Modules
7471

@@ -78,13 +75,8 @@ No modules.
7875

7976
| Name | Type |
8077
|------|------|
81-
| [aws_secretsmanager_secret.redis_password](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret) | resource |
82-
| [aws_secretsmanager_secret_version.redis_password](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/secretsmanager_secret_version) | resource |
83-
| [google_secret_manager_secret.redis_secret](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/secret_manager_secret) | resource |
84-
| [google_secret_manager_secret_version.redis_secret](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/secret_manager_secret_version) | resource |
8578
| [helm_release.redis](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
8679
| [kubernetes_namespace.redis](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
87-
| [random_password.redis_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
8880

8981
## Inputs
9082

@@ -99,7 +91,7 @@ No modules.
9991
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace where the Redis resources will be deployed. | `string` | `"redis"` | no |
10092
| <a name="input_recovery_window_aws_secret"></a> [recovery\_window\_aws\_secret](#input\_recovery\_window\_aws\_secret) | Number of days that AWS Secrets Manager will wait before it can delete the secret. The value can be 0 to force deletion without recovery, or a range from 7 to 30 days. | `number` | `0` | no |
10193
| <a name="input_redis_config"></a> [redis\_config](#input\_redis\_config) | Specify the configuration settings for Redis, including the name, environment, storage options, replication settings, store password to secret manager and custom YAML values. | `any` | <pre>{<br> "architecture": "replication",<br> "environment": "",<br> "master_volume_size": "",<br> "name": "",<br> "slave_replica_count": 1,<br> "slave_volume_size": "",<br> "storage_class_name": "",<br> "store_password_to_secret_manager": true,<br> "values_yaml": ""<br>}</pre> | no |
102-
| <a name="input_secret_provider_type"></a> [secret\_provider\_type](#input\_secret\_provider\_type) | Choose where secrets will be stored (aws, gcp) | `string` | `"aws"` | no |
94+
| <a name="input_redis_password"></a> [redis\_password](#input\_redis\_password) | n/a | `string` | `""` | no |
10395

10496
## Outputs
10597

File renamed without changes.
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ locals {
88
Department = "Engineering"
99
}
1010
store_password_to_secret_manager = true
11+
custom_credentials_enabled = true
12+
custom_credentials_config = {
13+
password = "aajdhgduy3873683dh"
14+
}
15+
}
16+
17+
module "aws" {
18+
source = "squareops/redis/kubernetes//provider/aws"
19+
environment = local.environment
20+
name = local.name
21+
store_password_to_secret_manager = local.store_password_to_secret_manager
22+
custom_credentials_enabled = local.custom_credentials_enabled
23+
custom_credentials_config = local.custom_credentials_config
1124
}
1225

1326
module "redis" {
@@ -25,9 +38,7 @@ module "redis" {
2538
secret_provider_type = "aws"
2639
}
2740
grafana_monitoring_enabled = true
28-
recovery_window_aws_secret = 0
29-
custom_credentials_enabled = true
30-
custom_credentials_config = {
31-
password = "aajdhgduy3873683dh"
32-
}
41+
custom_credentials_enabled = local.custom_credentials_enabled
42+
custom_credentials_config = local.custom_credentials_config
43+
redis_password = local.custom_credentials_enabled ? "" : module.aws.redis_password
3344
}

examples/complete/gcp/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## Redis Example
2+
![squareops_avatar]
3+
4+
[squareops_avatar]: https://squareops.com/wp-content/uploads/2022/12/squareops-logo.png
5+
6+
### [SquareOps Technologies](https://squareops.com/) Your DevOps Partner for Accelerating cloud journey.
7+
<br>
8+
This example will be very useful for users who are new to a module and want to quickly learn how to use it. By reviewing the examples, users can gain a better understanding of how the module works, what features it supports, and how to customize it to their specific needs.
9+
10+
## Usage
11+
12+
Use the provider file as per your need.
13+
- If deploying into AWS EKS use `provider-aws.tf` file and remove `provider-gcp.tf` file.
14+
- If deploying into Google GKE use `provider-gcp.tf` file and remove `provider-aws.tf` file.
15+
16+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
17+
## Requirements
18+
19+
No requirements.
20+
21+
## Providers
22+
23+
| Name | Version |
24+
|------|---------|
25+
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
26+
| <a name="provider_google"></a> [google](#provider\_google) | n/a |
27+
28+
## Modules
29+
30+
| Name | Source | Version |
31+
|------|--------|---------|
32+
| <a name="module_redis"></a> [redis](#module\_redis) | squareops/redis/kubernetes | n/a |
33+
34+
## Resources
35+
36+
| Name | Type |
37+
|------|------|
38+
| [aws_eks_cluster.cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster) | data source |
39+
| [aws_eks_cluster_auth.cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster_auth) | data source |
40+
| [google_client_config.default](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/client_config) | data source |
41+
| [google_container_cluster.primary](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/container_cluster) | data source |
42+
43+
## Inputs
44+
45+
No inputs.
46+
47+
## Outputs
48+
49+
| Name | Description |
50+
|------|-------------|
51+
| <a name="output_redis_credential"></a> [redis\_credential](#output\_redis\_credential) | Redis credentials used for accessing the database. |
52+
| <a name="output_redis_endpoints"></a> [redis\_endpoints](#output\_redis\_endpoints) | Redis endpoints in the Kubernetes cluster. |
53+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
master:
2+
affinity:
3+
nodeAffinity:
4+
requiredDuringSchedulingIgnoredDuringExecution:
5+
nodeSelectorTerms:
6+
- matchExpressions:
7+
- key: "Infra-Services"
8+
operator: In
9+
values:
10+
- "true"
11+
12+
replica:
13+
affinity:
14+
nodeAffinity:
15+
requiredDuringSchedulingIgnoredDuringExecution:
16+
nodeSelectorTerms:
17+
- matchExpressions:
18+
- key: "Infra-Services"
19+
operator: In
20+
values:
21+
- "true"

examples/complete/gcp/main.tf

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
locals {
2+
name = "redis"
3+
region = "us-east-2"
4+
environment = "prod"
5+
additional_tags = {
6+
Owner = "organization_name"
7+
Expires = "Never"
8+
Department = "Engineering"
9+
}
10+
store_password_to_secret_manager = true
11+
custom_credentials_enabled = true
12+
custom_credentials_config = {
13+
password = "aajdhgduy3873683dh"
14+
}
15+
}
16+
17+
module "gcp" {
18+
source = "squareops/redis/kubernetes//provider/gcp"
19+
project_id = ""
20+
environment = local.environment
21+
name = local.name
22+
store_password_to_secret_manager = local.store_password_to_secret_manager
23+
custom_credentials_enabled = local.custom_credentials_enabled
24+
custom_credentials_config = local.custom_credentials_config
25+
}
26+
27+
module "redis" {
28+
source = "squareops/redis/kubernetes"
29+
redis_config = {
30+
name = local.name
31+
values_yaml = file("./helm/values.yaml")
32+
environment = local.environment
33+
architecture = "replication"
34+
slave_volume_size = "10Gi"
35+
master_volume_size = "10Gi"
36+
storage_class_name = "gp3"
37+
slave_replica_count = 2
38+
store_password_to_secret_manager = local.store_password_to_secret_manager
39+
secret_provider_type = "aws"
40+
}
41+
grafana_monitoring_enabled = true
42+
custom_credentials_enabled = local.custom_credentials_enabled
43+
custom_credentials_config = local.custom_credentials_config
44+
redis_password = local.custom_credentials_enabled ? "" : module.gcp.redis_password
45+
}

examples/complete/gcp/output.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
output "redis_endpoints" {
2+
description = "Redis endpoints in the Kubernetes cluster."
3+
value = module.redis.redis_endpoints
4+
}
5+
6+
output "redis_credential" {
7+
description = "Redis credentials used for accessing the database."
8+
value = local.store_password_to_secret_manager ? null : module.redis.redis_credential
9+
}

0 commit comments

Comments
 (0)