Terraform创建Neptune DB时无法配置集群参数组的问题求助
解决Terraform中Neptune集群参数组关联问题
你的问题核心是搞混了Neptune参数组的关联层级:集群参数组(aws_neptune_cluster_parameter_group)需要关联到集群资源(aws_neptune_cluster),而不是集群实例(aws_neptune_cluster_instance),这就是你在实例里加参数报错的原因。
修改后的正确脚本
在aws_neptune_cluster资源中添加neptune_cluster_parameter_group_name参数,关联你创建的集群参数组:
## Create Neptune DB cluster and instance resource "aws_neptune_cluster_parameter_group" "neptune1" { family = "neptune1.2" name = "neptune1" description = "neptune cluster parameter group" parameter { name = "neptune_enable_audit_log" value = 1 apply_method = "pending-reboot" } } resource "aws_neptune_cluster" "gh-cluster" { cluster_identifier = "gh-db" skip_final_snapshot = true iam_database_authentication_enabled = false apply_immediately = true neptune_subnet_group_name = aws_neptune_subnet_group.gh-dbg.name vpc_security_group_ids = [aws_security_group.sgdb.id] iam_roles = [aws_iam_role.NeptuneRole.arn] # 关联集群参数组 neptune_cluster_parameter_group_name = aws_neptune_cluster_parameter_group.neptune1.name } resource "aws_neptune_cluster_instance" "gh-instance" { count = 1 cluster_identifier = aws_neptune_cluster.gh-cluster.id engine = "neptune" instance_class = "db.r5.large" apply_immediately = true } resource "aws_neptune_subnet_group" "gh-dbg" { name = "gh-dbg" subnet_ids = [aws_subnet.private.id, aws_subnet.public.id] }
额外说明
如果需要配置实例级别的参数(而非集群级),你需要创建aws_neptune_parameter_group资源,然后在aws_neptune_cluster_instance中通过neptune_parameter_group_name参数关联,但你的场景是集群参数组,所以只需要修改集群资源即可。
内容的提问来源于stack exchange,提问作者Akhil Chakicherla
相关产品推荐
相关产品推荐

