cyberlabrs / terraform-aws-opensearch

Terraform module to provision an OpenSearch cluster with SAML and Cognito authentication.
Apache License 2.0
31 stars 13 forks source link

Failed to create multiple opensearch domain in one vpc #13

Closed Dee-MaxX closed 1 year ago

Dee-MaxX commented 1 year ago

terraform apply

│ Error: creating Security Group (vpc-03b735cda1b80c124-elasticsearch): InvalidGroup.Duplicate: The security group 'vpc-03b735cda1b80c124-elasticsearch' already exists for VPC 'vpc-03b735cda1b80c124'
│       status code: 400, request id: 52842348-c664-4a74-a5d7-f854d0c26b66
│
│   with module.analytics-opensearch.aws_security_group.es[0],
│   on .terraform/modules/analytics-opensearch/main.tf line 31, in resource "aws_security_group" "es":
│   31: resource "aws_security_group" "es" {

config

module "opensearch-1" {
  source  = "cyberlabrs/opensearch/aws"
  version = "0.0.16"
  vpc = vpc-03b735cda1b80c124
}
module "opensearch-2" {
  source  = "cyberlabrs/opensearch/aws"
  version = "0.0.16"
  vpc = vpc-03b735cda1b80c124
}
andros3 commented 1 year ago

Hello, there is new variable default_security_group_name which represents name of default security group. You can fix this problem using this variable and setting some other value than default.