diff --git a/docs/data-sources/datacenter_routing_policy.md b/docs/data-sources/datacenter_routing_policy.md new file mode 100644 index 00000000..ffdde549 --- /dev/null +++ b/docs/data-sources/datacenter_routing_policy.md @@ -0,0 +1,181 @@ +--- +page_title: "apstra_datacenter_routing_policy Data Source - terraform-provider-apstra" +subcategory: "" +description: |- + This resource returns details of a Datacenter Routing Policy. +--- + +# apstra_datacenter_routing_policy (Data Source) + +This resource returns details of a Datacenter Routing Policy. + +## Example Usage + +```terraform +# This example pulls a routing policy by name and makes it +# avalilable via `output` +data "apstra_datacenter_routing_policy" "test" { + blueprint_id = "f30a5572-b899-408a-9195-e4d5bc1118cb" # required attribute + # id = "CX05RiY6Zcp32h7nPE0" # optional attribute + name = "test-label-d1f12" # optional attribute +} + +output "test_policy" { value = data.apstra_datacenter_routing_policy.test } + +# the output looks like: +# +# test_policy = { +# "aggregate_prefixes" = tolist([ +# "1.0.0.0/8", +# "2.0.0.0/7", +# ]) +# "blueprint_id" = "f30a5572-b899-408a-9195-e4d5bc1118cb" +# "description" = "test-description-d1f12" +# "expect_default_ipv4" = true +# "expect_default_ipv6" = true +# "export_policy" = { +# "export_l2_edge_subnets" = true +# "export_l3_edge_server_links" = true +# "export_loopbacks" = true +# "export_spine_leaf_links" = true +# "export_spine_superspine_links" = true +# "export_static_routes" = true +# } +# "extra_exports" = tolist([ +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "200.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "200.64.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = tonumber(null) +# "prefix" = "200.128.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = tonumber(null) +# "le_mask" = 14 +# "prefix" = "200.192.0.0/10" +# }, +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "210.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "210.0.0.0/10" +# }, +# ]) +# "extra_imports" = tolist([ +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "100.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "100.64.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 11 +# "le_mask" = tonumber(null) +# "prefix" = "100.128.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = tonumber(null) +# "le_mask" = 11 +# "prefix" = "100.192.0.0/10" +# }, +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "110.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "110.0.0.0/10" +# }, +# ]) +# "id" = "CX05RiY6Zcp32h7nPE0" +# "import_policy" = "default_only" +# "name" = "test-label-d1f12" +# } +``` + + +## Schema + +### Required + +- `blueprint_id` (String) Apstra Blueprint ID. + +### Optional + +- `id` (String) Apstra graph node ID. +- `name` (String) Web UI 'name' field. + +### Read-Only + +- `aggregate_prefixes` (List of String) BGP Aggregate routes to be imported into a routing zone (VRF) on all border switches. This option can only be set on routing policies associated with routing zones, and cannot be set on per-connectivity point policies. The aggregated routes are sent to all external router peers in a SZ (VRF). +- `description` (String) Web UI 'description' field. +- `expect_default_ipv4` (Boolean) Default IPv4 route is expected to be imported via protocol session using this policy. Used for rendering route expectations. +- `expect_default_ipv6` (Boolean) Default IPv6 route is expected to be imported via protocol session using this policy. Used for rendering route expectations. +- `export_policy` (Attributes) The export policy controls export of various types of fabric prefixes. (see [below for nested schema](#nestedatt--export_policy)) +- `extra_exports` (Attributes List) User defined export routes will be used in addition to any other routes specified in export policies. These policies are additive. To advertise only extra routes, disable all export types within 'export_policy', and only the extra prefixes specified here will be advertised. (see [below for nested schema](#nestedatt--extra_exports)) +- `extra_imports` (Attributes List) User defined import routes will be used in addition to any routes generated by the import policies. Prefixes specified here are additive to the import policy, unless 'import_policy' is set to "extra_only", in which only these routes will be imported. (see [below for nested schema](#nestedatt--extra_imports)) +- `import_policy` (String) One of '', 'default_only', 'all', 'extra_only' + + +### Nested Schema for `export_policy` + +Read-Only: + +- `export_l2_edge_subnets` (Boolean) Exports all virtual networks (VLANs) that have L3 addresses within a routing zone (VRF). +- `export_l3_edge_server_links` (Boolean) Exports all leaf to L3 server links within a routing zone (VRF). This will be an empty list on a layer2 based blueprint +- `export_loopbacks` (Boolean) Exports all loopbacks within a routing zone (VRF) across spine, leaf, and L3 servers. +- `export_spine_leaf_links` (Boolean) Exports all spine-supersine (fabric) links within the default routing zone (VRF) +- `export_spine_superspine_links` (Boolean) Exports all spine-leaf (fabric) links within a VRF. EVPN routing zones do not have spine-leaf addressing, so this generated list may be empty. For routing zones of type Virtual L3 Fabric, subinterfaces between spine-leaf will be included. +- `export_static_routes` (Boolean) Exports all subnets in a VRF associated with static routes from all fabric systems to external routers associated with this routing policy + + + +### Nested Schema for `extra_exports` + +Read-Only: + +- `action` (String) If the action is "permit", match the route. If the action is "deny", do not match the route. For composing complex policies, all prefix-list items will be processed in the order specified, top-down. This allows the user to deny a subset of a route that may otherwise be permitted. +- `ge_mask` (Number) Match less-specific prefixes from a parent prefix, up from `ge_mask` to the prefix length of the route. Range is 0-32 for IPv4, 0-128 for IPv6. If not specified, implies the prefix-list entry should be an exact match. The option can be optionally be used in combination with `le_mask`. `ge_mask` must be longer than the subnet prefix length. If `le_mask` and `ge_mask` are both specified, then `le_mask` must be greater than `ge_mask`. +- `le_mask` (Number) Match more-specific prefixes from a parent prefix, up until `le_mask` prefix len. Range is 0-32 for IPv4, 0-128 for IPv6. If not specified, implies the prefix-list entry should be an exact match. The option can be optionally be used in combination with `ge_mask`. `le_mask` must be longer than the subnet prefix length. If `le_mask` and `ge_mask` are both specified, then `le_mask` must be greater than `ge_mask`. +- `prefix` (String) IPv4 or IPv6 network address specified in the form of network/prefixlen. + + + +### Nested Schema for `extra_imports` + +Read-Only: + +- `action` (String) If the action is "permit", match the route. If the action is "deny", do not match the route. For composing complex policies, all prefix-list items will be processed in the order specified, top-down. This allows the user to deny a subset of a route that may otherwise be permitted. +- `ge_mask` (Number) Match less-specific prefixes from a parent prefix, up from `ge_mask` to the prefix length of the route. Range is 0-32 for IPv4, 0-128 for IPv6. If not specified, implies the prefix-list entry should be an exact match. The option can be optionally be used in combination with `le_mask`. `ge_mask` must be longer than the subnet prefix length. If `le_mask` and `ge_mask` are both specified, then `le_mask` must be greater than `ge_mask`. +- `le_mask` (Number) Match more-specific prefixes from a parent prefix, up until `le_mask` prefix len. Range is 0-32 for IPv4, 0-128 for IPv6. If not specified, implies the prefix-list entry should be an exact match. The option can be optionally be used in combination with `ge_mask`. `le_mask` must be longer than the subnet prefix length. If `le_mask` and `ge_mask` are both specified, then `le_mask` must be greater than `ge_mask`. +- `prefix` (String) IPv4 or IPv6 network address specified in the form of network/prefixlen. diff --git a/examples/data-sources/apstra_datacenter_routing_policy/example.tf b/examples/data-sources/apstra_datacenter_routing_policy/example.tf new file mode 100644 index 00000000..891bbb64 --- /dev/null +++ b/examples/data-sources/apstra_datacenter_routing_policy/example.tf @@ -0,0 +1,109 @@ +# This example pulls a routing policy by name and makes it +# avalilable via `output` +data "apstra_datacenter_routing_policy" "test" { + blueprint_id = "f30a5572-b899-408a-9195-e4d5bc1118cb" # required attribute + # id = "CX05RiY6Zcp32h7nPE0" # optional attribute + name = "test-label-d1f12" # optional attribute +} + +output "test_policy" { value = data.apstra_datacenter_routing_policy.test } + +# the output looks like: +# +# test_policy = { +# "aggregate_prefixes" = tolist([ +# "1.0.0.0/8", +# "2.0.0.0/7", +# ]) +# "blueprint_id" = "f30a5572-b899-408a-9195-e4d5bc1118cb" +# "description" = "test-description-d1f12" +# "expect_default_ipv4" = true +# "expect_default_ipv6" = true +# "export_policy" = { +# "export_l2_edge_subnets" = true +# "export_l3_edge_server_links" = true +# "export_loopbacks" = true +# "export_spine_leaf_links" = true +# "export_spine_superspine_links" = true +# "export_static_routes" = true +# } +# "extra_exports" = tolist([ +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "200.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "200.64.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = tonumber(null) +# "prefix" = "200.128.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = tonumber(null) +# "le_mask" = 14 +# "prefix" = "200.192.0.0/10" +# }, +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "210.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "210.0.0.0/10" +# }, +# ]) +# "extra_imports" = tolist([ +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "100.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "100.64.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 11 +# "le_mask" = tonumber(null) +# "prefix" = "100.128.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = tonumber(null) +# "le_mask" = 11 +# "prefix" = "100.192.0.0/10" +# }, +# { +# "action" = "permit" +# "ge_mask" = 11 +# "le_mask" = 13 +# "prefix" = "110.0.0.0/10" +# }, +# { +# "action" = "deny" +# "ge_mask" = 12 +# "le_mask" = 14 +# "prefix" = "110.0.0.0/10" +# }, +# ]) +# "id" = "CX05RiY6Zcp32h7nPE0" +# "import_policy" = "default_only" +# "name" = "test-label-d1f12" +# }