Skip to content

Commit c9e97d7

Browse files
committed
[minor_change] Add support for MACsec key with resource aci_macsec_key
1 parent 33dc81b commit c9e97d7

File tree

17 files changed

+2651
-1
lines changed

17 files changed

+2651
-1
lines changed

docs/data-sources/macsec_key.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
# Documentation generated by "gen/generator.go"; DO NOT EDIT.
3+
# In order to regenerate this file execute `go generate` from the repository root.
4+
# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md).
5+
subcategory: "Access Policies"
6+
layout: "aci"
7+
page_title: "ACI: aci_macsec_key"
8+
sidebar_current: "docs-aci-data-source-aci_macsec_key"
9+
description: |-
10+
Data source for ACI MACsec Key
11+
---
12+
13+
# aci_macsec_key #
14+
15+
Data source for ACI MACsec Key
16+
17+
## API Information ##
18+
19+
* Class: [macsecKeyPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/macsecKeyPol/overview)
20+
21+
* Supported in ACI versions: 3.1(1i) and later.
22+
23+
* Distinguished Name Formats:
24+
- `uni/fabric/macsecpcontfab/keychainp-{name}/keyp-{keyName}`
25+
- `uni/infra/macsecpcont/keychainp-{name}/keyp-{keyName}`
26+
27+
## GUI Information ##
28+
29+
* Locations:
30+
- `Fabric -> Access Policies -> Policies -> Interface -> MACSec -> MACSec KeyChain Policies -> MACSec Key Policy`
31+
- `Fabric -> Fabric Policies -> Policies -> MACSec -> MACSec KeyChain Policies -> MACSec Key Policy`
32+
33+
## Example Usage ##
34+
35+
```hcl
36+
37+
data "aci_macsec_key" "example_macsec_key_chain" {
38+
parent_dn = aci_macsec_key_chain.example.id
39+
key_name = "aa"
40+
}
41+
42+
```
43+
44+
## Schema ##
45+
46+
### Required ###
47+
48+
* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
49+
- [aci_macsec_key_chain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/macsec_key_chain) ([macsecKeyChainPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/macsecKeyChainPol/overview))
50+
* `key_name` (keyName) - (string) The key name of the MACsec Key object.
51+
52+
### Read-Only ###
53+
54+
* `id` - (string) The distinguished name (DN) of the MACsec Key object.
55+
* `annotation` (annotation) - (string) The annotation of the MACsec Key object. This attribute is supported in ACI versions: 3.2(1l) and later.
56+
* `description` (descr) - (string) The description of the MACsec Key object.
57+
* `end_time` (endTime) - (string) The end time of the MACsec Key object. The default value cannot be used directly, since APIC will calculate this value to the datetime representation which results in a applied state that does not match the planned state. Do not provide this attribute when APIC should calculate the current datetime ('now'). Furthermore, make sure that the time-zone part (in the full example this is '-08:00') matches the time-zone configured on APIC. Not doing so will result in unexpected behaviour.
58+
* `name` (name) - (string) The name of the MACsec Key object.
59+
* `name_alias` (nameAlias) - (string) The name alias of the MACsec Key object.
60+
* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation.
61+
* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object.
62+
* `pre_shared_key` (preSharedKey) - (string) The pre-shared key of the MACsec Key object.
63+
* `start_time` (startTime) - (string) The start time of the MACsec Key object. Please make sure that the time-zone part (in the full example this is '-08:00') matches the time-zone configured on APIC. Not doing so will result in unexpected behaviour.
64+
* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later.
65+
* `key` (key) - (string) The key used to uniquely identify this configuration object.
66+
* `value` (value) - (string) The value of the property.
67+
* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later.
68+
* `key` (key) - (string) The key used to uniquely identify this configuration object.
69+
* `value` (value) - (string) The value of the property.

docs/resources/macsec_key.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
---
2+
# Documentation generated by "gen/generator.go"; DO NOT EDIT.
3+
# In order to regenerate this file execute `go generate` from the repository root.
4+
# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md).
5+
subcategory: "Access Policies"
6+
layout: "aci"
7+
page_title: "ACI: aci_macsec_key"
8+
sidebar_current: "docs-aci-resource-aci_macsec_key"
9+
description: |-
10+
Manages ACI MACsec Key
11+
---
12+
13+
# aci_macsec_key #
14+
15+
Manages ACI MACsec Key
16+
17+
18+
19+
## API Information ##
20+
21+
* Class: [macsecKeyPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/macsecKeyPol/overview)
22+
23+
* Supported in ACI versions: 3.1(1i) and later.
24+
25+
* Distinguished Name Formats:
26+
- `uni/fabric/macsecpcontfab/keychainp-{name}/keyp-{keyName}`
27+
- `uni/infra/macsecpcont/keychainp-{name}/keyp-{keyName}`
28+
29+
## GUI Information ##
30+
31+
* Locations:
32+
- `Fabric -> Access Policies -> Policies -> Interface -> MACSec -> MACSec KeyChain Policies -> MACSec Key Policy`
33+
- `Fabric -> Fabric Policies -> Policies -> MACSec -> MACSec KeyChain Policies -> MACSec Key Policy`
34+
35+
## Example Usage ##
36+
37+
The configuration snippet below creates a MACsec Key with only required attributes.
38+
39+
```hcl
40+
41+
resource "aci_macsec_key" "example_macsec_key_chain" {
42+
parent_dn = aci_macsec_key_chain.example.id
43+
key_name = "aa"
44+
}
45+
46+
```
47+
The configuration snippet below shows all possible attributes of the MACsec Key.
48+
49+
!> This example might not be valid configuration and is only used to show all possible attributes.
50+
51+
```hcl
52+
53+
resource "aci_macsec_key" "full_example_macsec_key_chain" {
54+
parent_dn = aci_macsec_key_chain.example.id
55+
annotation = "annotation"
56+
description = "description_1"
57+
end_time = "infinite"
58+
key_name = "aa"
59+
name = "name_1"
60+
name_alias = "name_alias_1"
61+
owner_key = "owner_key_1"
62+
owner_tag = "owner_tag_1"
63+
pre_shared_key = "123456789a223456789a323456789abc"
64+
start_time = "2025-11-28T03:12:09.452-08:00"
65+
annotations = [
66+
{
67+
key = "key_0"
68+
value = "value_1"
69+
}
70+
]
71+
tags = [
72+
{
73+
key = "key_0"
74+
value = "value_1"
75+
}
76+
]
77+
}
78+
79+
```
80+
81+
All examples for the MACsec Key resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_macsec_key) folder.
82+
83+
## Schema ##
84+
85+
### Required ###
86+
87+
* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
88+
- [aci_macsec_key_chain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/macsec_key_chain) ([macsecKeyChainPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/macsecKeyChainPol/overview))
89+
* `key_name` (keyName) - (string) The key name of the MACsec Key object.
90+
91+
### Read-Only ###
92+
93+
* `id` - (string) The distinguished name (DN) of the MACsec Key object.
94+
95+
### Optional ###
96+
97+
* `annotation` (annotation) - (string) The annotation of the MACsec Key object. This attribute is supported in ACI versions: 3.2(1l) and later.
98+
- Default: `"orchestrator:terraform"`
99+
* `description` (descr) - (string) The description of the MACsec Key object.
100+
* `end_time` (endTime) - (string) The end time of the MACsec Key object. The default value cannot be used directly, since APIC will calculate this value to the datetime representation which results in a applied state that does not match the planned state. Do not provide this attribute when APIC should calculate the current datetime ('now'). Furthermore, make sure that the time-zone part (in the full example this is '-08:00') matches the time-zone configured on APIC. Not doing so will result in unexpected behaviour.
101+
- Default: `"infinite"`
102+
* `name` (name) - (string) The name of the MACsec Key object.
103+
* `name_alias` (nameAlias) - (string) The name alias of the MACsec Key object.
104+
* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation.
105+
* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object.
106+
* `pre_shared_key` (preSharedKey) - (string) The pre-shared key of the MACsec Key object.
107+
* `start_time` (startTime) - (string) The start time of the MACsec Key object. Please make sure that the time-zone part (in the full example this is '-08:00') matches the time-zone configured on APIC. Not doing so will result in unexpected behaviour.
108+
- Default: `"now"`
109+
* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later.
110+
#### Required ####
111+
112+
* `key` (key) - (string) The key used to uniquely identify this configuration object.
113+
* `value` (value) - (string) The value of the property.
114+
* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later.
115+
#### Required ####
116+
117+
* `key` (key) - (string) The key used to uniquely identify this configuration object.
118+
* `value` (value) - (string) The value of the property.
119+
120+
## Importing
121+
122+
An existing MACsec Key can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command:
123+
124+
```
125+
terraform import aci_macsec_key.example_macsec_key_chain uni/fabric/macsecpcontfab/keychainp-{name}/keyp-{keyName}
126+
```
127+
128+
Starting in Terraform version 1.5, an existing MACsec Key can be imported
129+
using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration:
130+
131+
```
132+
import {
133+
id = "uni/fabric/macsecpcontfab/keychainp-{name}/keyp-{keyName}"
134+
to = aci_macsec_key.example_macsec_key_chain
135+
}
136+
```

docs/resources/macsec_key_chain.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,7 @@ import {
126126
to = aci_macsec_key_chain.example
127127
}
128128
```
129+
130+
## Child Resources
131+
132+
- [aci_macsec_key](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/macsec_key)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
data "aci_macsec_key" "example_macsec_key_chain" {
3+
parent_dn = aci_macsec_key_chain.example.id
4+
key_name = "aa"
5+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
terraform {
2+
required_providers {
3+
aci = {
4+
source = "ciscodevnet/aci"
5+
}
6+
}
7+
}
8+
9+
provider "aci" {
10+
username = ""
11+
password = ""
12+
url = ""
13+
insecure = true
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
terraform {
2+
required_providers {
3+
aci = {
4+
source = "ciscodevnet/aci"
5+
}
6+
}
7+
}
8+
9+
provider "aci" {
10+
username = ""
11+
password = ""
12+
url = ""
13+
insecure = true
14+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
resource "aci_macsec_key" "full_example_macsec_key_chain" {
3+
parent_dn = aci_macsec_key_chain.example.id
4+
annotation = "annotation"
5+
description = "description_1"
6+
end_time = "infinite"
7+
key_name = "aa"
8+
name = "name_1"
9+
name_alias = "name_alias_1"
10+
owner_key = "owner_key_1"
11+
owner_tag = "owner_tag_1"
12+
pre_shared_key = "123456789a223456789a323456789abc"
13+
start_time = "2025-11-28T03:12:09.452-08:00"
14+
annotations = [
15+
{
16+
key = "key_0"
17+
value = "value_1"
18+
}
19+
]
20+
tags = [
21+
{
22+
key = "key_0"
23+
value = "value_1"
24+
}
25+
]
26+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
resource "aci_macsec_key" "example_macsec_key_chain" {
3+
parent_dn = aci_macsec_key_chain.example.id
4+
key_name = "aa"
5+
}

gen/definitions/classes.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,4 +1290,12 @@ macsecKeyChainPol:
12901290
sub_category: "Access Policies"
12911291
ui_locations:
12921292
- "Fabric -> Access Policies -> Policies -> Interface -> MACSec -> MACSec KeyChain Policies"
1293-
- "Fabric -> Fabric Policies -> Policies -> MACSec -> MACSec KeyChain Policies"
1293+
- "Fabric -> Fabric Policies -> Policies -> MACSec -> MACSec KeyChain Policies"
1294+
1295+
macsecKeyPol:
1296+
resource_name: "macsec_key"
1297+
sub_category: "Access Policies"
1298+
ui_locations:
1299+
- "Fabric -> Access Policies -> Policies -> Interface -> MACSec -> MACSec KeyChain Policies -> MACSec Key Policy"
1300+
- "Fabric -> Fabric Policies -> Policies -> MACSec -> MACSec KeyChain Policies -> MACSec Key Policy"
1301+
class_version: "6.0(2h)-"

gen/definitions/properties.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,3 +2923,26 @@ macsecParamPol:
29232923
macsecKeyChainPol:
29242924
default_values:
29252925
parent_dn: "uni/infra/macsecpcont"
2926+
2927+
macsecKeyPol:
2928+
remove_valid_values:
2929+
endTime:
2930+
- "infinite"
2931+
startTime:
2932+
- "now"
2933+
documentation:
2934+
keyName: "The key name of the %s object."
2935+
endTime: "The end time of the %s object. The default value cannot be used directly, since APIC will calculate this value to the datetime representation which results in a applied state that does not match the planned state. Do not provide this attribute when APIC should calculate the current datetime ('now'). Furthermore, make sure that the time-zone part (in the full example this is '-08:00') matches the time-zone configured on APIC. Not doing so will result in unexpected behaviour."
2936+
startTime: "The start time of the %s object. Please make sure that the time-zone part (in the full example this is '-08:00') matches the time-zone configured on APIC. Not doing so will result in unexpected behaviour."
2937+
preSharedKey: "The pre-shared key of the %s object."
2938+
test_values:
2939+
default:
2940+
start_time: "2025-11-28T03:12:09.452-08:00"
2941+
all:
2942+
start_time: "2025-11-28T03:12:09.452-08:00"
2943+
pre_shared_key: "123456789a223456789a323456789abc"
2944+
resource_required:
2945+
key_name: "aa"
2946+
start_time: "2025-11-28T03:12:09.452-08:00"
2947+
datasource_required:
2948+
key_name: "aa"

0 commit comments

Comments
 (0)