Jer*_*emy 6 amazon-elasticache terraform terraform-provider-aws
我正在尝试使用 Terraform 在 Elasticache 上启动 Redis 实例,但遇到以下错误。
* module.main.module.redis.aws_elasticache_security_group.redis: 1 error(s) occurred:
* aws_elasticache_security_group.redis: Error creating CacheSecurityGroup: InvalidParameterValue: Use of cache security groups is not permitted in this API version for your account.
Run Code Online (Sandbox Code Playgroud)
我在 GH 问题中发现的任何内容都没有帮助。这是我的 Terraform 的样子(我已经确认变量被正确传递):
resource "aws_elasticache_subnet_group" "redis" {
name = "vpc-public-subnet"
description = "subnet where redis will live"
subnet_ids = ["${var.subnet}"]
}
resource "aws_elasticache_security_group" "redis" {
name = "redis-security-group"
security_group_names = ["${var.redis_sec_group}"]
}
resource "aws_elasticache_replication_group" "redis" {
automatic_failover_enabled = true
availability_zones = ["us-east-2a"]
replication_group_id = "${var.environment}-myapp-rep-group-1"
replication_group_description = "redis rep group - ${var.environment} env"
node_type = "cache.t2.micro"
number_cache_clusters = 2
parameter_group_name = "default.redis3.2"
port = 6379
at_rest_encryption_enabled = true
transit_encryption_enabled = true
subnet_group_name = "${aws_elasticache_subnet_group.redis.name}"
security_group_ids = ["${aws_elasticache_security_group.redis.id}"]
lifecycle {
ignore_changes = ["number_cache_clusters"]
}
}
resource "aws_elasticache_cluster" "redis" {
cluster_id = "${var.environment}-myapp"
count = 1
replication_group_id = "${aws_elasticache_replication_group.redis.id}"
}
Run Code Online (Sandbox Code Playgroud)
我认为问题可能出在我的 IAM 用户上,所以我添加了该AmazonElastiCacheFullAccess
策略,但它仍然说这是不允许的。在阅读了 AWS 文档上关于API_CreateCacheSecurityGroup 的帖子并确认这三个策略包含在AmazonElastiCacheFullAccess
.
这些资源似乎存在一些错误行为
https://github.com/hashicorp/terraform/issues/10127
对不起,请在这儿忍受我。发布这个并完全写出来确实帮助我处理我的想法。我发现aws_elasticache_security_group
是不必要的,只是决定["${var.redis_sec_group}"]
直接传入security_group_ids
for aws_elasticache_replication_group
。
对于以前已经处理过这个问题的人来说,这似乎很明显,现在对我来说也是如此。但进入这个全新的它不是。所以这不是我遇到的权限问题的解决方案。但是,就像许多事情一样,我退后一步并质疑我是否真的需要它,答案是否定的。
看起来您已经意识到aws_elasticache_security_group
只有在您不使用 VPC的情况下才能在 EC2 经典账户中使用。最近创建的账户不允许在 VPC 之外创建网络级资源(实例、负载均衡器、RDS 实例、Elasticache 实例等)。
资源的Terraform 文档中aws_elasticache_security_group
提到了这一点:
注意:ElastiCache 安全组仅在使用VPC外的 ElastiCache 集群时使用。如果您使用的是 VPC,请参阅 ElastiCache 子网组资源。
Elasticache 安全组的AWS 文档进一步详细介绍:
重要的
Amazon ElastiCache 安全组仅适用于不在 Amazon Virtual Private Cloud 环境 (VPC) 中运行的集群。如果您在 Amazon Virtual Private Cloud 中运行,则控制台导航窗格中的安全组不可用。
如果您在 Amazon VPC 中运行 ElastiCache 节点,您可以使用 Amazon VPC 安全组控制对集群的访问,这与 ElastiCache 安全组不同。有关在 Amazon VPC 中使用 ElastiCache 的更多信息,请参阅 Amazon VPC 和 ElastiCache 安全
归档时间: |
|
查看次数: |
2753 次 |
最近记录: |