Skip to content

Commit c2889fc

Browse files
committed
fix: publicly access
Signed-off-by: thxCode <[email protected]>
1 parent db0b088 commit c2889fc

File tree

4 files changed

+10
-22
lines changed

4 files changed

+10
-22
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ No modules.
7575
| Name | Description | Type | Default | Required |
7676
|------|-------------|------|---------|:--------:|
7777
| <a name="input_context"></a> [context](#input\_context) | Receive contextual information. When Walrus deploys, Walrus will inject specific contextual information into this field.<br><br>Examples:<pre>context:<br> project:<br> name: string<br> id: string<br> environment:<br> name: string<br> id: string<br> resource:<br> name: string<br> id: string</pre> | `map(any)` | `{}` | no |
78-
| <a name="input_infrastructure"></a> [infrastructure](#input\_infrastructure) | Specify the infrastructure information for deploying.<br><br>Examples:<pre>infrastructure:<br> vpc_id: string # the ID of the VPC where the Redis service applies<br> kms_key_id: string, optional # the ID of the KMS key which to encrypt the Redis data<br> domain_suffix: string, optional # a private DNS namespace of the CloudMap where to register the applied Redis service<br> publicly_accessible: bool # whether the Redis service is publicly accessible</pre> | <pre>object({<br> vpc_id = string<br> kms_key_id = optional(string)<br> domain_suffix = optional(string)<br> publicly_accessible = optional(bool, false)<br> })</pre> | n/a | yes |
78+
| <a name="input_infrastructure"></a> [infrastructure](#input\_infrastructure) | Specify the infrastructure information for deploying.<br><br>Examples:<pre>infrastructure:<br> vpc_id: string # the ID of the VPC where the Redis service applies<br> kms_key_id: string, optional # the ID of the KMS key which to encrypt the Redis data<br> domain_suffix: string, optional # a private DNS namespace of the CloudMap where to register the applied Redis service</pre> | <pre>object({<br> vpc_id = string<br> kms_key_id = optional(string)<br> domain_suffix = optional(string)<br> })</pre> | n/a | yes |
7979
| <a name="input_architecture"></a> [architecture](#input\_architecture) | Specify the deployment architecture, select from standalone or replication. | `string` | `"standalone"` | no |
8080
| <a name="input_replication_readonly_replicas"></a> [replication\_readonly\_replicas](#input\_replication\_readonly\_replicas) | Specify the number of read-only replicas under the replication deployment. | `number` | `1` | no |
8181
| <a name="input_engine_version"></a> [engine\_version](#input\_engine\_version) | Specify the deployment engine version. | `string` | `"7.0"` | no |

main.tf

+3-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ data "aws_vpc" "selected" {
3434

3535
lifecycle {
3636
postcondition {
37-
condition = try(var.infrastructure.domain_suffix == null, false) || (self.enable_dns_support && self.enable_dns_hostnames)
37+
condition = var.infrastructure.domain_suffix == null || (self.enable_dns_support && self.enable_dns_hostnames)
3838
error_message = "VPC needs to enable DNS support and DNS hostnames resolution"
3939
}
4040
}
@@ -68,7 +68,7 @@ data "aws_kms_key" "selected" {
6868
}
6969

7070
data "aws_service_discovery_dns_namespace" "selected" {
71-
count = try(var.infrastructure.domain_suffix != null, false) ? 1 : 0
71+
count = var.infrastructure.domain_suffix != null ? 1 : 0
7272

7373
name = var.infrastructure.domain_suffix
7474
type = "DNS_PRIVATE"
@@ -127,7 +127,6 @@ locals {
127127
if try(c.value != "", false)
128128
}
129129
)
130-
publicly_accessible = try(var.infrastructure.publicly_accessible, false)
131130
}
132131

133132
resource "aws_elasticache_parameter_group" "target" {
@@ -172,7 +171,7 @@ resource "aws_security_group_rule" "target" {
172171
security_group_id = aws_security_group.target.id
173172
type = "ingress"
174173
protocol = "tcp"
175-
cidr_blocks = local.publicly_accessible ? ["0.0.0.0/0", data.aws_vpc.selected.cidr_block] : [data.aws_vpc.selected.cidr_block]
174+
cidr_blocks = [data.aws_vpc.selected.cidr_block]
176175
from_port = 6379
177176
to_port = 6379
178177
}

schema.yaml

-9
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ components:
3434
required:
3535
- vpc_id
3636
properties:
37-
publicly_accessible:
38-
description: |
39-
Specify whether to enable public access. If enabled, the Redis service can be accessed from the public network.
40-
default: false
41-
nullable: true
42-
title: Publicly Accessible
43-
type: boolean
44-
x-walrus-ui:
45-
order: 4
4637
domain_suffix:
4738
title: Domain Suffix
4839
type: string

variables.tf

+6-8
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,15 @@ Specify the infrastructure information for deploying.
3535
Examples:
3636
```
3737
infrastructure:
38-
vpc_id: string # the ID of the VPC where the Redis service applies
39-
kms_key_id: string, optional # the ID of the KMS key which to encrypt the Redis data
40-
domain_suffix: string, optional # a private DNS namespace of the CloudMap where to register the applied Redis service
41-
publicly_accessible: bool # whether the Redis service is publicly accessible
38+
vpc_id: string # the ID of the VPC where the Redis service applies
39+
kms_key_id: string, optional # the ID of the KMS key which to encrypt the Redis data
40+
domain_suffix: string, optional # a private DNS namespace of the CloudMap where to register the applied Redis service
4241
```
4342
EOF
4443
type = object({
45-
vpc_id = string
46-
kms_key_id = optional(string)
47-
domain_suffix = optional(string)
48-
publicly_accessible = optional(bool, false)
44+
vpc_id = string
45+
kms_key_id = optional(string)
46+
domain_suffix = optional(string)
4947
})
5048
}
5149

0 commit comments

Comments
 (0)