我在尝试执行Terraform Plan时一直收到这个错误。
我正在部署一个带有IAM配置文件的RDS实例。
resource "aws_db_instance" "sql_server_instance" {
allocated_storage = var.min_storage
max_allocated_storage = var.max_storage
engine = "sqlserver-se"
engine_version = "15.00.4073.23.v1"
license_model = "license-included"
instance_class = "db.t3.xlarge"
#name = "rds-${var.environment}-sql-server-01"
username = "${var.environment}rdsmaster"
password = random_password.password.result
db_subnet_group_name = aws_db_subnet_group.subnet_group.name
deletion_protection = false
enabled_cloudwatch_logs_exports = ["error"]
multi_az = var.rds_multi_az
domain = aws_directory_service_directory.gemsad.id
domain_iam_role_name = aws_db_instance_role_association.db_iam_role.arn
skip_final_snapshot = true
vpc_security_group_ids = [
aws_security_group.sql_sg.id,
]
depends_on = [
aws_security_group.sql_sg,
aws_db_instance_role_association.db_iam_role
]
}
resource "aws_db_instance_role_association" "db_iam_role" {
db_instance_identifier = aws_db_instance.sql_server_instance.id
feature_name = "S3_INTEGRATION"
role_arn = aws_iam_role.app_server_role.arn
}
IAM配置文件如下:
resource "aws_iam_role" "app_server_role" {
name = "app-server-role"
assume_role_policy = data.aws_iam_policy_document.app_server_assume_role.json
permissions_boundary = "arn:aws:iam::${var.account_id}:policy/******"
}
这是我在管道上遇到的错误:
Error: Cycle: aws_db_instance_role_association.db_iam_role, aws_db_instance.sql_server_instance
有人看到我哪里出错了吗?
在没有依赖aws_db_instance_role_association.db_iam_role
的情况下尝试这将首先尝试创建关联,但如果需要创建Db。。。所以我相信这就是你的周期。