Skip to content

Commit

Permalink
Add organization adaptive policy acl resource and data source
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Sep 18, 2024
1 parent 6fc82ac commit e60b726
Show file tree
Hide file tree
Showing 13 changed files with 1,129 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/data-sources/organization_adaptive_policy_acl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "meraki_organization_adaptive_policy_acl Data Source - terraform-provider-meraki"
subcategory: "Organizations"
description: |-
This data source can read the Organization Adaptive Policy ACL configuration.
---

# meraki_organization_adaptive_policy_acl (Data Source)

This data source can read the `Organization Adaptive Policy ACL` configuration.

## Example Usage

```terraform
data "meraki_organization_adaptive_policy_acl" "example" {
id = "12345678"
organization_id = "123456"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `organization_id` (String) Organization ID

### Optional

- `id` (String) The id of the object
- `name` (String) Name of the adaptive policy ACL

### Read-Only

- `description` (String) Description of the adaptive policy ACL
- `ip_version` (String) IP version of adpative policy ACL. One of: `any`, `ipv4` or `ipv6`
- `rules` (Attributes List) An ordered array of the adaptive policy ACL rules. (see [below for nested schema](#nestedatt--rules))

<a id="nestedatt--rules"></a>
### Nested Schema for `rules`

Read-Only:

- `dst_port` (String) Destination port. Must be in the format of single port: `1`, port list: `1,2` or port range: `1-10`, and in the range of 1-65535, or `any`. Default is `any`.
- `policy` (String) `allow` or `deny` traffic specified by this rule.
- `protocol` (String) The type of protocol (must be `tcp`, `udp`, `icmp` or `any`).
- `src_port` (String) Source port. Must be in the format of single port: `1`, port list: `1,2` or port range: `1-10`, and in the range of 1-65535, or `any`. Default is `any`.
72 changes: 72 additions & 0 deletions docs/resources/organization_adaptive_policy_acl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "meraki_organization_adaptive_policy_acl Resource - terraform-provider-meraki"
subcategory: "Organizations"
description: |-
This resource can manage the Organization Adaptive Policy ACL configuration.
---

# meraki_organization_adaptive_policy_acl (Resource)

This resource can manage the `Organization Adaptive Policy ACL` configuration.

## Example Usage

```terraform
resource "meraki_organization_adaptive_policy_acl" "example" {
organization_id = "123456"
description = "Blocks sensitive web traffic"
ip_version = "ipv6"
name = "Block sensitive web traffic"
rules = [
{
dst_port = "22-30"
policy = "deny"
protocol = "tcp"
src_port = "1,33"
}
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `ip_version` (String) IP version of adpative policy ACL. One of: `any`, `ipv4` or `ipv6`
- Choices: `any`, `ipv4`, `ipv6`
- `name` (String) Name of the adaptive policy ACL
- `organization_id` (String) Organization ID
- `rules` (Attributes List) An ordered array of the adaptive policy ACL rules. (see [below for nested schema](#nestedatt--rules))

### Optional

- `description` (String) Description of the adaptive policy ACL

### Read-Only

- `id` (String) The id of the object

<a id="nestedatt--rules"></a>
### Nested Schema for `rules`

Required:

- `policy` (String) `allow` or `deny` traffic specified by this rule.
- Choices: `allow`, `deny`
- `protocol` (String) The type of protocol (must be `tcp`, `udp`, `icmp` or `any`).
- Choices: `any`, `icmp`, `tcp`, `udp`

Optional:

- `dst_port` (String) Destination port. Must be in the format of single port: `1`, port list: `1,2` or port range: `1-10`, and in the range of 1-65535, or `any`. Default is `any`.
- `src_port` (String) Source port. Must be in the format of single port: `1`, port list: `1,2` or port range: `1-10`, and in the range of 1-65535, or `any`. Default is `any`.

## Import

Import is supported using the following syntax:

```shell
terraform import meraki_organization_adaptive_policy_acl.example "<organization_id>,<id>"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "meraki_organization_adaptive_policy_acl" "example" {
id = "12345678"
organization_id = "123456"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import meraki_organization_adaptive_policy_acl.example "<organization_id>,<id>"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "meraki_organization_adaptive_policy_acl" "example" {
organization_id = "123456"
description = "Blocks sensitive web traffic"
ip_version = "ipv6"
name = "Block sensitive web traffic"
rules = [
{
dst_port = "22-30"
policy = "deny"
protocol = "tcp"
src_port = "1,33"
}
]
}
3 changes: 3 additions & 0 deletions gen/definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ func traverseProperties(m map[string]interface{}, path []string, gjsonPath strin
if desc, ok := propMap["description"]; ok {
attr.Description = sanitizeDescription(desc.(string))
}
if strings.Contains(attr.Description, "ordered array") {
attr.OrderedList = true
}
if t, ok := jsonTypes[items["type"].(string)]; ok {
attr.ElementType = t
childGjsonPath := (gjsonPath + "." + propName + ".0")[1:]
Expand Down
62 changes: 62 additions & 0 deletions gen/definitions/organization_adaptive_policy_acl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Organization Adaptive Policy ACL
rest_endpoint: /organizations/%v/adaptivePolicy/acls
id_name: aclId
data_source_name_query: true
doc_category: Organizations
attributes:
- tf_name: organization_id
type: String
reference: true
description: Organization ID
example: "123456"
test_value: data.meraki_organization.test.id
- model_name: description
type: String
description: Description of the adaptive policy ACL
example: Blocks sensitive web traffic
- model_name: ipVersion
type: String
mandatory: true
description: 'IP version of adpative policy ACL. One of: `any`, `ipv4` or `ipv6`'
example: ipv6
enum_values: [any, ipv4, ipv6]
- model_name: name
type: String
mandatory: true
description: Name of the adaptive policy ACL
example: Block sensitive web traffic
- model_name: rules
type: List
mandatory: true
description: An ordered array of the adaptive policy ACL rules.
ordered_list: true
attributes:
- model_name: dstPort
type: String
description: 'Destination port. Must be in the format of single port: `1`, port list: `1,2` or port range: `1-10`, and in the range of 1-65535, or `any`. Default is `any`.'
example: 22-30
- model_name: policy
type: String
mandatory: true
description: '`allow` or `deny` traffic specified by this rule.'
example: deny
enum_values: [allow, deny]
- model_name: protocol
type: String
mandatory: true
description: The type of protocol (must be `tcp`, `udp`, `icmp` or `any`).
example: tcp
enum_values: [any, icmp, tcp, udp]
- model_name: srcPort
type: String
description: 'Source port. Must be in the format of single port: `1`, port list: `1,2` or port range: `1-10`, and in the range of 1-65535, or `any`. Default is `any`.'
example: 1,33
test_prerequisites: |
data "meraki_organization" "test" {
name = "Dev"
}
resource "meraki_network" "test" {
organization_id = data.meraki_organization.test.id
name = "Network1"
product_types = ["switch"]
}
Loading

0 comments on commit e60b726

Please sign in to comment.