Commit 097ef79d authored by Anton Babenko's avatar Anton Babenko Committed by GitHub

Not ignore changes in rules description (#52)

parent c41e4d01
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
sha: v1.5.0
rev: v1.6.0
hooks:
- id: terraform_fmt
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: v1.2.0
rev: v1.2.3
hooks:
- id: check-merge-conflict
......@@ -29,10 +29,6 @@ resource "aws_security_group_rule" "ingress_rules" {
from_port = "${element(var.rules[var.ingress_rules[count.index]], 0)}"
to_port = "${element(var.rules[var.ingress_rules[count.index]], 1)}"
protocol = "${element(var.rules[var.ingress_rules[count.index]], 2)}"
lifecycle {
ignore_changes = ["description"]
}
}
##########################
......@@ -53,10 +49,6 @@ resource "aws_security_group_rule" "ingress_with_source_security_group_id" {
from_port = "${lookup(var.ingress_with_source_security_group_id[count.index], "from_port", element(var.rules[lookup(var.ingress_with_source_security_group_id[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.ingress_with_source_security_group_id[count.index], "to_port", element(var.rules[lookup(var.ingress_with_source_security_group_id[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.ingress_with_source_security_group_id[count.index], "protocol", element(var.rules[lookup(var.ingress_with_source_security_group_id[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
# Security group rules with "cidr_blocks", but without "ipv6_cidr_blocks", "source_security_group_id" and "self"
......@@ -73,10 +65,6 @@ resource "aws_security_group_rule" "ingress_with_cidr_blocks" {
from_port = "${lookup(var.ingress_with_cidr_blocks[count.index], "from_port", element(var.rules[lookup(var.ingress_with_cidr_blocks[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.ingress_with_cidr_blocks[count.index], "to_port", element(var.rules[lookup(var.ingress_with_cidr_blocks[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.ingress_with_cidr_blocks[count.index], "protocol", element(var.rules[lookup(var.ingress_with_cidr_blocks[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
# Security group rules with "ipv6_cidr_blocks", but without "cidr_blocks", "source_security_group_id" and "self"
......@@ -93,10 +81,6 @@ resource "aws_security_group_rule" "ingress_with_ipv6_cidr_blocks" {
from_port = "${lookup(var.ingress_with_ipv6_cidr_blocks[count.index], "from_port", element(var.rules[lookup(var.ingress_with_ipv6_cidr_blocks[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.ingress_with_ipv6_cidr_blocks[count.index], "to_port", element(var.rules[lookup(var.ingress_with_ipv6_cidr_blocks[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.ingress_with_ipv6_cidr_blocks[count.index], "protocol", element(var.rules[lookup(var.ingress_with_ipv6_cidr_blocks[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
# Security group rules with "self", but without "cidr_blocks" and "source_security_group_id"
......@@ -114,10 +98,6 @@ resource "aws_security_group_rule" "ingress_with_self" {
from_port = "${lookup(var.ingress_with_self[count.index], "from_port", element(var.rules[lookup(var.ingress_with_self[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.ingress_with_self[count.index], "to_port", element(var.rules[lookup(var.ingress_with_self[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.ingress_with_self[count.index], "protocol", element(var.rules[lookup(var.ingress_with_self[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
#################
......@@ -142,10 +122,6 @@ resource "aws_security_group_rule" "egress_rules" {
from_port = "${element(var.rules[var.egress_rules[count.index]], 0)}"
to_port = "${element(var.rules[var.egress_rules[count.index]], 1)}"
protocol = "${element(var.rules[var.egress_rules[count.index]], 2)}"
lifecycle {
ignore_changes = ["description"]
}
}
#########################
......@@ -166,10 +142,6 @@ resource "aws_security_group_rule" "egress_with_source_security_group_id" {
from_port = "${lookup(var.egress_with_source_security_group_id[count.index], "from_port", element(var.rules[lookup(var.egress_with_source_security_group_id[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.egress_with_source_security_group_id[count.index], "to_port", element(var.rules[lookup(var.egress_with_source_security_group_id[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.egress_with_source_security_group_id[count.index], "protocol", element(var.rules[lookup(var.egress_with_source_security_group_id[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
# Security group rules with "cidr_blocks", but without "ipv6_cidr_blocks", "source_security_group_id" and "self"
......@@ -186,10 +158,6 @@ resource "aws_security_group_rule" "egress_with_cidr_blocks" {
from_port = "${lookup(var.egress_with_cidr_blocks[count.index], "from_port", element(var.rules[lookup(var.egress_with_cidr_blocks[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.egress_with_cidr_blocks[count.index], "to_port", element(var.rules[lookup(var.egress_with_cidr_blocks[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.egress_with_cidr_blocks[count.index], "protocol", element(var.rules[lookup(var.egress_with_cidr_blocks[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
# Security group rules with "ipv6_cidr_blocks", but without "cidr_blocks", "source_security_group_id" and "self"
......@@ -206,10 +174,6 @@ resource "aws_security_group_rule" "egress_with_ipv6_cidr_blocks" {
from_port = "${lookup(var.egress_with_ipv6_cidr_blocks[count.index], "from_port", element(var.rules[lookup(var.egress_with_ipv6_cidr_blocks[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.egress_with_ipv6_cidr_blocks[count.index], "to_port", element(var.rules[lookup(var.egress_with_ipv6_cidr_blocks[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.egress_with_ipv6_cidr_blocks[count.index], "protocol", element(var.rules[lookup(var.egress_with_ipv6_cidr_blocks[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
# Security group rules with "self", but without "cidr_blocks" and "source_security_group_id"
......@@ -227,10 +191,6 @@ resource "aws_security_group_rule" "egress_with_self" {
from_port = "${lookup(var.egress_with_self[count.index], "from_port", element(var.rules[lookup(var.egress_with_self[count.index], "rule", "_")], 0))}"
to_port = "${lookup(var.egress_with_self[count.index], "to_port", element(var.rules[lookup(var.egress_with_self[count.index], "rule", "_")], 1))}"
protocol = "${lookup(var.egress_with_self[count.index], "protocol", element(var.rules[lookup(var.egress_with_self[count.index], "rule", "_")], 2))}"
lifecycle {
ignore_changes = ["description"]
}
}
################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment