Skip to content

Commit

Permalink
initial atomic counter module
Browse files Browse the repository at this point in the history
  • Loading branch information
otatar committed Jan 30, 2025
1 parent ba0222b commit edfcc9d
Show file tree
Hide file tree
Showing 11 changed files with 264 additions and 0 deletions.
9 changes: 9 additions & 0 deletions aci_access_policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,15 @@ locals {
}]
}

module "atomic-counter" {
source = "./modules/terraform-aci-atomic-counter"

admin_state = try(group.admin_state, local.defaults.apic.access_policies.atomic_conter.admin_state)
name = value.name
mode = value.mode
description = value.description
}

module "aci_access_span_destination_group" {
source = "./modules/terraform-aci-access-span-destination-group"

Expand Down
34 changes: 34 additions & 0 deletions modules/terraform-aci-atomic-counter/.terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '>= 0.14.0'

formatter: markdown table

content: |-
# Terraform ACI Atomic Counter Module
Atomic Counter
Location in GUI:
`Operations` » `Visualization` » `Settings`
## Examples
```hcl
{{ include "./examples/complete/main.tf" }}
```
{{ .Requirements }}
{{ .Providers }}
{{ .Inputs }}
{{ .Outputs }}
{{ .Resources }}
output:
file: README.md
mode: replace

sort:
enabled: false
55 changes: 55 additions & 0 deletions modules/terraform-aci-atomic-counter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!-- BEGIN_TF_DOCS -->
# Terraform Atomic Counter Module

Atomic Counter Module

Location in GUI:
`Operations` » `Visualization` » `Settings`

## Examples

```hcl
module "aci_banner" {
source = "netascode/nac-aci/aci/modules/terraform-atomic-counter"
version = ">= 0.8.0"
admin_state = true
mode = "path"
user_domain = "all"
name = "My_Atomic_Counter"
}
```

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
| <a name="requirement_aci"></a> [aci](#requirement\_aci) | >= 2.0.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aci"></a> [aci](#provider\_aci) | >= 2.0.0 |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_admin_state"></a> [admin\_state](#input\_admin\_state) | Admin state. | `bool` | `false` | no |
| <a name="input_mode></a> [mode](#input\_mode) | APIC GUI banner URL. | `string` | `"trail|path"` | no |


## Outputs

| Name | Description |
|------|-------------|
| <a name="output_dn"></a> [dn](#output\_dn) | Distinguished name of `OngoingAcMode` object. |

## Resources

| Name | Type |
|------|------|
| [aci_rest_managed.aaaPreLoginBanner](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/rest_managed) | resource |
<!-- END_TF_DOCS -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '>= 0.14.0'

formatter: markdown table

content: |-
# Banner Example
To run this example you need to execute:
```bash
$ terraform init
$ terraform plan
$ terraform apply
```
Note that this example will create resources. Resources can be destroyed with `terraform destroy`.
```hcl
{{ include "./main.tf" }}
```
output:
file: README.md
mode: replace
25 changes: 25 additions & 0 deletions modules/terraform-aci-atomic-counter/examples/complete/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- BEGIN_TF_DOCS -->
# Banner Example

To run this example you need to execute:

```bash
$ terraform init
$ terraform plan
$ terraform apply
```

Note that this example will create resources. Resources can be destroyed with `terraform destroy`.

```hcl
module "aci_banner" {
source = "netascode/nac-aci/aci//modules/terraform-aci-banner"
version = ">= 0.8.0"
apic_gui_banner_url = "http://1.1.1.1"
apic_gui_alias = "PROD"
apic_cli_banner = "My CLI Banner"
switch_cli_banner = "My Switch Banner"
}
```
<!-- END_TF_DOCS -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module "aci_banner" {
source = "netascode/nac-aci/aci//modules/terraform-aci-banner"
version = ">= 0.8.0"

apic_gui_banner_url = "http://1.1.1.1"
apic_gui_alias = "PROD"
apic_cli_banner = "My CLI Banner"
switch_cli_banner = "My Switch Banner"
}
11 changes: 11 additions & 0 deletions modules/terraform-aci-atomic-counter/examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

terraform {
required_version = ">= 1.0.0"

required_providers {
aci = {
source = "CiscoDevNet/aci"
version = ">= 2.0.0"
}
}
}
9 changes: 9 additions & 0 deletions modules/terraform-aci-atomic-counter/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "aci_rest_managed" "OngoingAcMode" {
dn = "uni/fabric/ogmode"
class_name = "OngoingAcMode"
escape_html = var.escape_html
content = {
adminSt = var.admin_state == true ? "on" : "off"
name = var.name
}
}
4 changes: 4 additions & 0 deletions modules/terraform-aci-atomic-counter/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "dn" {
value = aci_rest_managed.OngoingAcMode.id
description = "Distinguished name of `OngoingAcMode` object."
}
73 changes: 73 additions & 0 deletions modules/terraform-aci-atomic-counter/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
variable "admin_state" {
description = "Admin state."
type = bool
default = true
}

variable "annotation" {
description = "Annotation value."
type = string
default = null

validation {
condition = var.annotation == null || can(regex("^[a-zA-Z0-9_.:-]{0,64}$", var.annotation))
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `_`, `.`, `:`, `-`. Maximum characters: 64."
}
}

variable "description" {
description = "Description."
type = string
default = ""

validation {
condition = can(regex("^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]{0,128}$", var.description))
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `\\`, `!`, `#`, `$`, `%`, `(`, `)`, `*`, `,`, `-`, `.`, `/`, `:`, `;`, `@`, ` `, `_`, `{`, `|`, }`, `~`, `?`, `&`, `+`. Maximum characters: 128."
}
}


variable "name" {
description = "Atomic Counter Name."
type = string

validation {
condition = can(regex("^[a-zA-Z0-9_.:-]{0,64}$", var.name))
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `_`, `.`, `:`, `-`. Maximum characters: 64."
}
}

variable "mode" {
description = "The BGP Domain name"
type = string
default = "trail"
}

variable "alias" {
description = "Alias."
type = string
default = ""

validation {
condition = can(regex("^[a-zA-Z0-9_.:-]{0,64}$", var.alias))
error_message = "Allowed characters: `a`-`z`, `A`-`Z`, `0`-`9`, `_`, `.`, `:`, `-`. Maximum characters: 64."
}
}

variable "owner_key" {
description = "Owner Key"
type = string
default = ""
}

variable "owner_tag" {
description = "Owner Tag"
type = string
default = ""
}

variable "user_domain" {
description = "User domain"
type = string
default = "all"
}
11 changes: 11 additions & 0 deletions modules/terraform-aci-atomic-counter/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

terraform {
required_version = ">= 1.0.0"

required_providers {
aci = {
source = "CiscoDevNet/aci"
version = ">= 2.0.0"
}
}
}

0 comments on commit edfcc9d

Please sign in to comment.