我在tf代码中添加了以下内容:
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";是有效的地形参数。
错误消息中的关键术语是module
:
Error: module "rds": "monitoring_role_arn" is not a valid argument
这始终意味着,您正在使用的模块,而不是AWS资源,在其variables.tf
中缺少您试图传递给它的特定变量。
这与模块内部使用的任何资源无关。即使你删除了模块中的所有资源(例如RDS(,你也会得到同样的错误。