terraform-provider-yandex icon indicating copy to clipboard operation
terraform-provider-yandex copied to clipboard

Не отслеживает изменение групп безопасности

Open roquie opened this issue 1 year ago • 1 comments

Создав ГБ первым прогоном и забыв про нее на время:

resource "yandex_vpc_security_group" "dev_default_cluster_public_services" {
  name        = "dev-default-cluster-public-services"
  description = "Group rules allow connections to services from the internet. Apply the rules only for node groups."
  network_id  = data.yandex_vpc_network.default.id

  ingress {
    protocol       = "TCP"
    description    = "Rule allows incoming traffic from the internet to the NodePort port range. Add ports or change existing ones to the required ports."
    v4_cidr_blocks = ["0.0.0.0/0"]
    from_port      = 30000
    to_port        = 32767
  }
}

Я решил разрешить еще весь исходящий трафик:

resource "yandex_vpc_security_group" "dev_default_cluster_public_services" {
  name        = "dev-default-cluster-public-services"
  description = "Group rules allow connections to services from the internet. Apply the rules only for node groups."
  network_id  = data.yandex_vpc_network.default.id

  ingress {
    protocol       = "TCP"
    description    = "Rule allows incoming traffic from the internet to the NodePort port range. Add ports or change existing ones to the required ports."
    v4_cidr_blocks = ["0.0.0.0/0"]
    from_port      = 30000
    to_port        = 32767
  }

  egress {
    description    = "The rule allows all outgoing traffic."
    protocol       = "ANY"
    v4_cidr_blocks = ["0.0.0.0/0"]
    from_port      = 0
    to_port        = 65535
  }
}

Применил, отработало. Позже, эта потребность отпала и я решил убрать egress-правило из ресурса (удалил полностью блок). Запускаю terraform и получаю замечательное:

No changes. Your infrastructure matches the configuration.

То есть оно не нашло разницу между тем, что в конфиге и тем, что уже применено/в облаке. Пришлось удалять руками в гуй-консоли.

Terraform v1.5.2 on darwin_arm64

  • provider registry.terraform.io/yandex-cloud/yandex v0.108.1

roquie avatar Feb 23 '24 14:02 roquie