Replies: 2 comments 3 replies
-
@d0schuma Can you try this fw config? resource "opentelekomcloud_fw_rule_v2" "fw_rule" {
count = var.ecs_count
name = "${var.environment}-${var.project}-rule-0${count.index + 1}"
description = "SSH connection"
action = "allow"
protocol = "tcp"
destination_ip_address = "10.0.10.5${count.index + 1}"
destination_port = "22"
enabled = "true"
}
resource "opentelekomcloud_fw_policy_v2" "ingress_policy" {
name = "fw-policy"
rules = formatlist("%s", opentelekomcloud_fw_rule_v2.fw_rule[*].id)
}
data "opentelekomcloud_networking_port_v2" "fw_port" {
network_id = opentelekomcloud_networking_network_v2.network.id
device_owner = "network:router_interface_distributed"
depends_on = [
opentelekomcloud_networking_router_interface_v2.router_interface
]
}
resource "opentelekomcloud_fw_firewall_group_v2" "firewall_group_1" {
name = "my-firewall-group"
ports = [data.opentelekomcloud_networking_port_v2.fw_port.id]
ingress_policy_id = opentelekomcloud_fw_policy_v2.ingress_policy.id
} |
Beta Was this translation helpful? Give feedback.
-
I had the same problem and now I have a follow-up question concerning the data source "opentelekomcloud_networking_port_v2". Question: Can you giv e me a working example how filtering fixed_ips would look like in practice? The documentation only states it supports an argument "fixed_ip" with the description "(Optional) The port IP address filter.", but I can not find an info on how such a filter needs to be defined. Simply passing the corresponding IP does not work for me. I have the following port resource with three fixed_ip blocks (output of terraform state show):
And the datasource from your example above:
This will lead to a datasource error message that it found three ports. Well, congrats Sherlock, I would have expected the data source to return a map here, but okay, I can live with this. Because the documentation states it supports filtering for fixed_ips. Let's create a for_each loop which iterates over the fixed_ip blocks:
But I have no luck here. I tried several things, even AWS-style filter{} blocks and other things, and even when I hardcode the IP "10.0.10.51" in your otherwise working example, I always get the error "Error: no opentelekomcloud_networking_port_v2 found". So, can you give me an example how to use the fixed_ip argument correctly? Thanks, Ralf |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am trying to associate a successfully created firewall included rules with a VPC subnet. However, it fails or the documentation is unfortunately somewhat unclear. Can you help me, please? What is the problem here?
I get the following error message when I try to add the firewall via
ports = formatlist("%s", opentelekomcloud_networking_port_v2.ports[*].id)
inside of theresource "opentelekomcloud_fw_firewall_group_v2" "firewall_group_1" {}
:The following are the necessary
.tf
files:networks.tf
routers.tf
firewall.tf
Beta Was this translation helpful? Give feedback.
All reactions