hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
42.76k stars 9.56k forks source link

terraform forces new resource for neptune cluster everytime I run #20429

Closed vathsaas closed 5 years ago

vathsaas commented 5 years ago

I am using terraform "v0.11.11" and aws provider version 1.59.0.

My config is as follows

resource "aws_neptune_cluster" "neptune_cluster" {
  cluster_identifier            = "${var.cluster_name}"
  engine                        = "neptune"
  engine_version                = "${var.engine_version}"
  availability_zones            = ["${var.ec2_zones}"]
  backup_retention_period       = "${var.backup_retention_period}"
  iam_roles                     = ["${var.iam_roles}"]
  neptune_subnet_group_name     = "${aws_neptune_subnet_group.neptune_subnet.id}"
  preferred_backup_window       = "${var.backup_window}"
  preferred_maintenance_window  = "${var.maintenance_window}"
  vpc_security_group_ids        = ["${aws_security_group.neptune_security_group.id}"]
  apply_immediately             = true
  skip_final_snapshot           = "${var.skip_final_snapshot}"

  tags = {
    Name                  = "${var.cluster_name}"
    fe_common.cost_center = "si_eng-${var.environment}"
    fe_common.env_type    = "${var.environment}"
    fe_common.product     = "core_knowledge_platform"
  }
}

resource "aws_neptune_subnet_group" "neptune_subnet" {
  name       = "${var.cluster_name}"
  subnet_ids = ["${var.subnet_ids}"]

  tags = {
    Name                  = "${var.cluster_name}"
    fe_common.cost_center = "si_eng-${var.environment}"
    fe_common.env_type    = "${var.environment}"
    fe_common.product     = "core_knowledge_platform"
  }
}

resource "aws_neptune_cluster_instance" "neptune_instance" {
  count                         = "${var.instance_count}"
  cluster_identifier            = "${aws_neptune_cluster.neptune_cluster.id}"
  engine                        = "neptune"
  engine_version                = "${var.engine_version}"
  instance_class                = "${var.instance_type}"
  neptune_subnet_group_name     = "${aws_neptune_subnet_group.neptune_subnet.id}"
  apply_immediately             = true

  tags = {
    Name                  = "${var.cluster_name}"
    fe_common.cost_center = "si_eng-${var.environment}"
    fe_common.env_type    = "${var.environment}"
    fe_common.product     = "core_knowledge_platform"
  }
}

resource "aws_security_group" "neptune_security_group" {
  name   = "${var.cluster_name}"
  vpc_id = "${var.vpc_id}"
  egress {
    from_port   = 0
    to_port     = 0
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port   = "8182"
    to_port     = "8182"
    cidr_blocks = ["${var.subnet_ips}"]
    protocol    = "TCP"
  }

  tags = {
    Name                  = "${var.cluster_name}"
    fe_common.cost_center = "si_eng-${var.environment}"
    fe_common.env_type    = "${var.environment}"
    fe_common.product     = "core_knowledge_platform"
  }
}

resource "aws_neptune_event_subscription" "neptune_event" {
  name          = "${var.cluster_name}-event"
  sns_topic_arn = "${aws_sns_topic.neptune_topic.arn}"
  source_type   = "db-cluster"
  source_ids    = ["${aws_neptune_cluster.neptune_cluster.id}"]

  event_categories = [
    "failover",
    "notification",
    "maintenance",
    "failure",
  ]

  tags = {
    Name                  = "${var.cluster_name}"
    fe_common.cost_center = "si_eng-${var.environment}"
    fe_common.env_type    = "${var.environment}"
    fe_common.product     = "core_knowledge_platform"
  }
}

resource "aws_sns_topic" "neptune_topic" {
  name = "${var.cluster_name}-topic"
}

Even when there is no change to any of the above configs, terraform forces new resource for neptune-cluster, and its instances.

ghost commented 5 years ago

This issue has been automatically migrated to terraform-providers/terraform-provider-aws#7652 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to terraform-providers/terraform-provider-aws#7652.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.