问题描述
module "rds" "app" {
source = "git@github.com:*****/aws-terraform-rds.git"
name = "${var.rds_name_app}"
engine = "${var.rds_engine_app}"
engine_version = "${var.rds_engine_version_app}"
family = "${var.rds_family_app}"
instance_class = "${var.rds_instance_class_app}"
password = "${random_string.rds_password.result}"
port = "${var.rds_port_app}"
security_groups = ["${aws_security_group.rds_app.id}"]
subnets = ["${module.vpc.public_subnets}"]
auto_minor_version_upgrade = "${var.rds_auto_minor_version_upgrade_app}"
backup_retention_period = "${var.rds_backup_retention_period_app}"
backup_window = "${var.rds_backup_window_app}"
maintenance_window = "${var.rds_maintenance_window_app}"
environment = "${var.environment}"
kms_key_id = "${aws_kms_key.rds.arn}"
multi_az = "${var.rds_multi_az_app}"
notification_topic = "${var.rds_notification_topic_app}"
publicly_accessible = "${var.rds_publicly_accessible_app}"
storage_encrypted = "${var.rds_storage_encrypted_app}"
storage_size = "${var.rds_storage_size_app}"
storage_type = "${var.rds_storage_type_app}"
monitoring_interval = "${var.rds_monitoring_interval_app}"
monitoring_role_arn = "${var.rds_monitoring_role_arn_app}"
apply_immediately = true
变量存在于variables.tf文件中。
错误:模块“ rds”:“ monitoring_role_arn”不是有效的参数
我不确定为什么会收到此错误,因为“ monitoring_role_arn”是有效的terraform参数。
解决方法
错误消息中的关键术语是module
:
Error: module "rds": "monitoring_role_arn" is not a valid argument
这始终表示您正在使用的模块而不是AWS资源在其variables.tf
中缺少要传递给它的特定变量。
这与模块内部使用的任何资源无关。即使您要删除模块中的所有资源(例如RDS),也会遇到相同的错误。