【发布时间】:2021-08-01 11:34:21
【问题描述】:
我正在尝试运行这个模块:https://registry.terraform.io/modules/azavea/postgresql-rds/aws/latest 这是根据那里找到的信息创建的 main.tf 文件:
provider "aws" {
region = "us-east-2"
access_key = "key_here"
secret_key = "key_here"
}
module postgresql_rds {
source = "github.com/azavea/terraform-aws-postgresql-rds"
vpc_id = "vpc-2470994d"
instance_type = "db.t3.micro"
database_name = "tyler"
database_username = "admin"
database_password = "admin1234"
subnet_group = "tyler-subnet-1"
project = "Postgres-ts"
environment = "Staging"
alarm_actions = ["arn:aws:sns:us-east-2:304831784377:tyler-test"]
ok_actions = ["arn:aws:sns:us-east-2:304831784377:tyler-test"]
insufficient_data_actions = ["arn:aws:sns:us-east-2:304831784377:tyler-test"]
database_identifier = "jl23kj32sdf"
}
我收到一个错误:
错误:创建数据库实例时出错:DBSubnetGroupNotFoundFault:未找到 DBSubnetGroup 'tyler-subnet-1'。 │ 状态码:404,请求id:a95975dd-5456-444a-8f64-440fc4c1782f │ │ 用 module.postgresql_rds.aws_db_instance.postgresql, │ 在 .terraform/modules/postgresql_rds/main.tf 第 46 行,资源“aws_db_instance”“postgresql”中: │ 46:资源“aws_db_instance”“postgresql”{
我已经尝试了页面中的示例:
subnet_group = aws_db_subnet_group.default.name
我使用了页面中的默认示例,在“Usage”下,即subnet_group = aws_db_subnet_group.default.name。我还使用了 AWS 的子网 ID。我还为子网分配了一个名称,并在上面的 main.tf 中使用了名称“tyler-subnet-1”。我得到了相同的基本错误,所有三个尝试输入。有什么我不明白的这里要求的信息是什么?
【问题讨论】:
-
aws_db_subnet_group.default.name来自哪里?它没有显示在您的程序中。 -
@Marcin 在此页面上:registry.terraform.io/modules/azavea/postgresql-rds/aws/latest 这是“使用”下示例中的默认值。我正在尝试任何方法,看看有什么效果。
标签: postgresql amazon-web-services terraform