{"action":"created","issue":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/6788","repository_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/6788/labels{/name}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/6788/comments","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/6788/events","html_url":"https://github.com/terraform-providers/terraform-provider-aws/issues/6788","id":389452550,"node_id":"MDU6SXNzdWUzODk0NTI1NTA=","number":6788,"title":"Append aws_security_group_rule to existing aws_security_group requires EC2 teardown?","user":{"login":"bee-keeper","id":1985097,"node_id":"MDQ6VXNlcjE5ODUwOTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1985097?v=4","gravatar_id":"","url":"https://api.github.com/users/bee-keeper","html_url":"https://github.com/bee-keeper","followers_url":"https://api.github.com/users/bee-keeper/followers","following_url":"https://api.github.com/users/bee-keeper/following{/other_user}","gists_url":"https://api.github.com/users/bee-keeper/gists{/gist_id}","starred_url":"https://api.github.com/users/bee-keeper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bee-keeper/subscriptions","organizations_url":"https://api.github.com/users/bee-keeper/orgs","repos_url":"https://api.github.com/users/bee-keeper/repos","events_url":"https://api.github.com/users/bee-keeper/events{/privacy}","received_events_url":"https://api.github.com/users/bee-keeper/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-10T19:31:34Z","updated_at":"2018-12-10T20:31:14Z","closed_at":"2018-12-10T20:31:14Z","author_association":"NONE","body":"Hi there,\r\n\r\nI'm using Terraform v0.11.10 with provider.aws v1.51.0.  Not sure if this is a bug or if I'm incorrectly using TF.\r\n\r\nWith this config `terraform apply` creates an EC2 and appends the rule given to the already existing security group `${var.sg_id}`:\r\n\r\n```\r\nresource \"aws_security_group\" \"ssh\" {\r\n  name = \"ssh\"\r\n  description = \"SSH\"\r\n  vpc_id = \"${var.vpc_id}\"\r\n\r\n  ingress {\r\n    from_port = 22\r\n    to_port = 22\r\n    protocol = \"tcp\"\r\n    cidr_blocks = [\r\n      \"0.0.0.0/0\"]\r\n  }\r\n}\r\n\r\nresource \"aws_instance\" \"web\" {\r\n  ami           = \"${data.aws_ami.ubuntu.id}\" \r\n  instance_type = \"t2.micro\"\r\n  associate_public_ip_address = true\r\n  security_groups = [\"${aws_security_group.ssh.id}\"]\r\n  key_name = \"${var.key_pair}\"\r\n\r\n  subnet_id = \"${var.subnet_id}\"\r\n}\r\n\r\nresource \"aws_security_group_rule\" \"test_rule\" {\r\n  type            = \"ingress\"\r\n  from_port       = 22\r\n  to_port         = 22\r\n  protocol        = \"tcp\"\r\n  source_security_group_id = \"${aws_security_group.ssh.id}\"\r\n  description = \"\"\r\n  security_group_id = \"${var.sg_id}\"\r\n  depends_on = [\"aws_security_group.ssh\"]\r\n}\r\n```\r\nThereafter, every rerun of `terraform apply` causes Terraform to create a new EC2 instance.  This is unexpected since the group exists, the rule exists and the EC2 exists.  "},"comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/comments/445961665","html_url":"https://github.com/terraform-providers/terraform-provider-aws/issues/6788#issuecomment-445961665","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/6788","id":445961665,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTk2MTY2NQ==","user":{"login":"bee-keeper","id":1985097,"node_id":"MDQ6VXNlcjE5ODUwOTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1985097?v=4","gravatar_id":"","url":"https://api.github.com/users/bee-keeper","html_url":"https://github.com/bee-keeper","followers_url":"https://api.github.com/users/bee-keeper/followers","following_url":"https://api.github.com/users/bee-keeper/following{/other_user}","gists_url":"https://api.github.com/users/bee-keeper/gists{/gist_id}","starred_url":"https://api.github.com/users/bee-keeper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bee-keeper/subscriptions","organizations_url":"https://api.github.com/users/bee-keeper/orgs","repos_url":"https://api.github.com/users/bee-keeper/repos","events_url":"https://api.github.com/users/bee-keeper/events{/privacy}","received_events_url":"https://api.github.com/users/bee-keeper/received_events","type":"User","site_admin":false},"created_at":"2018-12-10T20:31:14Z","updated_at":"2018-12-10T20:31:14Z","author_association":"NONE","body":"Sorry I'm an idiot, this can be closed.  \r\n\r\nI was using `security_groups` instead of `vpc_security_group_ids` on the EC2,"}}
{"actor":{"display_login":"bee-keeper"}}