我目前在部署 Amazon ElastiCache 集群与全局复制组时面临着 Terraform 配置的挑战。主要目标是确保 ElastiCache 集群的静态和传输中加密
resource "aws_elasticache_cluster" "redis_cluster" {
cluster_id = var.redis_cluster_name
engine = "redis"
engine_version = "6.2"
node_type = "cache.t2.small"
num_cache_nodes = 1
parameter_group_name = "default.redis6.x"
subnet_group_name = var.subnet_group_name
security_group_ids = [var.security_group_id]
port = 6379
log_delivery_configuration {
destination = aws_cloudwatch_log_group.redis_cluster_logs.name
destination_type = "cloudwatch-logs"
log_format = "text"
log_type = "slow-log"
}
maintenance_window = "sun:05:00-sun:06:00"
snapshot_window = "01:00-02:00"
snapshot_retention_limit = 30
}
resource "aws_elasticache_global_replication_group" "{replication_group_identifier}" {
global_replication_group_id_suffix = "{unique_suffix}"
automatic_failover_enabled = true
primary_replication_group_id = aws_elasticache_cluster.{cluster_identifier}.id
at_rest_encryption_enabled = true
transit_encryption_enabled = true
}
无法为“at_rest_encryption_enabled”配置值:其值将根据应用此配置的结果自动决定。 aws_elasticache_global_replication_group.{replication_group_identifier} 的不可配置属性值,位于 infra.tf 第 537 行,资源“aws_elasticache_global_replication_group”“{replication_group_identifier}”中:transit_encryption_enabled = true
无法为“transit_encryption_enabled”配置值:其值将根据应用此配置的结果自动决定。在这个脚本中
我似乎无法在
aws_elasticache_global_replication_group
资源中显式设置“at_rest_encryption_enabled”和“transit_encryption_enabled”的值。如何正确配置这些属性来为我的 ElastiCache 集群启用加密?
我感谢任何有关解决此问题的帮助或指导。如果需要更多详细信息,请告诉我。
查看文档,您将看到
aws_elasticache_global_replication_group
上的加密设置仅是输出属性。这些不是您可以设置的值。
查看同一页面上的示例,您似乎需要创建常规
aws_elasticache_replication_group
资源,并在该资源上指定加密设置,然后将该资源作为 aws_elasticache_global_replication_group
传递给 primary_replication_group_id
。
您当前正在传递
aws_elasticache_cluster
作为 primary_replication_group_id
,这似乎是错误的。我认为你会得到一个错误,或者至少会出现一些意想不到的行为。