繁体   English   中英

为 redshift 创建新的安全组并使用 Terraform 应用

[英]Create new security group for redshift and apply using Terraform

我对 Terraform 很陌生,并且正在努力解决一些问题。

我正在为个人项目使用 Redshift,并且我想更新默认安全组的入站安全规则,该安全组在创建时应用于 Redshift。

如果我在 AWS 控制台中执行此操作,我将添加一个新的入站规则,其中TypeAll Traffic并且SourceAnywhere -IPv4添加0.0.0.0/0

main.tf下面我尝试创建一个新的安全组并将其应用于 Redshift,但我收到VPC-by-Default customers cannot use cluster security groups错误。

我做错了什么?

resource "aws_redshift_cluster" "redshift" {
  cluster_identifier = "redshift-cluster-pipeline"
  skip_final_snapshot = true terraform destroy
  master_username    = "awsuser"
  master_password    = var.db_password
  node_type          = "dc2.large"
  cluster_type       = "single-node"
  publicly_accessible = "true"
  iam_roles = [aws_iam_role.redshift_role.arn]
  cluster_security_groups = [aws_redshift_security_group.redshift-sg.name]
}

resource "aws_redshift_security_group" "redshift-sg" {
  name = "redshift-sg"
  ingress {
    cidr = "0.0.0.0/0"
    }

Terraform 资源aws_redshift_security_group文档指出:

创建一个新的 Amazon Redshift 安全组。 您使用安全组来控制对非 VPC 集群的访问

您收到的错误消息显然表明您使用了错误类型的安全组,您需要改用 VPC 安全组。 创建适当的 VPC 安全组后,您将通过vpc_security_group_ids属性在aws_redshift_cluster资源中设置它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM