Skip to content

Commit

Permalink
[ignore] Removed default dependency in the pkiTP and pkiKeyRing resou…
Browse files Browse the repository at this point in the history
…rce tests
  • Loading branch information
shrsr committed Jun 14, 2024
1 parent 9f97fd7 commit f540fe4
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 87 deletions.
1 change: 1 addition & 0 deletions docs/data-sources/certificate_authority.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ data "aci_certificate_authority" "example_tenant" {

* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
- [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/fvTenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview))
- Default: `uni/userext/pkiext`

### Read-Only ###

Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/key_ring.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ data "aci_key_ring" "example_tenant" {

* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
- [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/fvTenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview))
- Default: `uni/userext/pkiext`

### Read-Only ###

Expand Down
1 change: 1 addition & 0 deletions docs/data-sources/netflow_monitor_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ data "aci_netflow_monitor_policy" "example_tenant" {
- The distinguished name (DN) of classes below can be used but currently there is no available resource for it:
- [infraInfra](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/infraInfra/overview)

- Default: `uni/infra`

### Read-Only ###

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/certificate_authority.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ All examples for the Certificate Authority resource can be found in the [example
An existing Certificate Authority can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command:

```
terraform import aci_certificate_authority.example uni/tn-{name}/certstore/tp-{name}
terraform import aci_certificate_authority.example uni/userext/pkiext/tp-{name}
```

Starting in Terraform version 1.5, an existing Certificate Authority can be imported
using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration:

```
import {
id = "uni/tn-{name}/certstore/tp-{name}"
id = "uni/userext/pkiext/tp-{name}"
to = aci_certificate_authority.example
}
```
4 changes: 2 additions & 2 deletions docs/resources/key_ring.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,15 @@ All examples for the Key Ring resource can be found in the [examples](https://gi
An existing Key Ring can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command:

```
terraform import aci_key_ring.example uni/tn-{name}/certstore/keyring-{name}
terraform import aci_key_ring.example uni/userext/pkiext/keyring-{name}
```

Starting in Terraform version 1.5, an existing Key Ring can be imported
using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration:

```
import {
id = "uni/tn-{name}/certstore/keyring-{name}"
id = "uni/userext/pkiext/keyring-{name}"
to = aci_key_ring.example
}
```
8 changes: 7 additions & 1 deletion gen/definitions/classes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ pkiTP:
contained_by: "fvTenant"
wrapper_class: "cloudCertStore"
test_type: "cloud"
dn_formats:
- "uni/userext/pkiext/tp-{name}"
- "uni/tn-{name}/certstore/tp-{name}"

pkiKeyRing:
sub_category: "AAA"
Expand All @@ -242,4 +245,7 @@ pkiKeyRing:
contained_by: "fvTenant"
wrapper_class: "cloudCertStore"
test_type: "cloud"

dn_formats:
- "uni/userext/pkiext/keyring-{name}"
- "uni/tn-{name}/certstore/keyring-{name}"

8 changes: 2 additions & 6 deletions gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1170,8 +1170,6 @@ func (m *Model) SetClassInclude() {
for key, value := range classDetails.(map[interface{}]interface{}) {
if key.(string) == "include" {
m.Include = value.(bool)
} else {
m.Include = false
}
}
}
Expand Down Expand Up @@ -1231,8 +1229,6 @@ func (m *Model) SetClassExclude() {
for key, value := range classDetails.(map[interface{}]interface{}) {
if key.(string) == "exclude" {
m.Exclude = value.(bool)
} else {
m.Exclude = false
}
}
}
Expand Down Expand Up @@ -1791,7 +1787,7 @@ func GetMultiParentFormats(classPkgName string, definitions Definitions) map[str
defaultParentEntry := GetDefaultValues(classPkgName, "parent_dn", definitions)
if defaultParentEntry != "" {
defaultMultiParentFormat := MultiParentFormat{
ContainedBy: "default",
ContainedBy: "",
RnPrepend: defaultParentEntry,
}
multiParentFormats["default"] = defaultMultiParentFormat
Expand Down Expand Up @@ -1942,7 +1938,7 @@ func setDocumentationData(m *Model, definitions Definitions) {
if len(getMultiParentFormats) > 0 {
m.DocumentationParentDns = nil
for _, format := range getMultiParentFormats {
if format.ContainedBy != "default" {
if format.ContainedBy != "" {
m.DocumentationParentDns = append(m.DocumentationParentDns, fmt.Sprintf("[%s_%s](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/%s) (%s)", providerName, GetResourceName(format.ContainedBy, definitions), format.ContainedBy, GetDevnetDocForClass(format.ContainedBy)))
}
}
Expand Down
4 changes: 1 addition & 3 deletions gen/templates/datasource.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ Data source for {{.ResourceNameAsDescription}}
{{- range .DocumentationParentDns}}
- {{ . }}
{{- end}}
{{- if getDefaultValues .PkgName "parent_dn" $.Definitions}}
- Default: `{{ getDefaultValues .PkgName "parent_dn" $.Definitions}}`
{{ end}}
{{- end}}
{{- range .Properties}}
{{- if .IsNaming}}
Expand All @@ -73,6 +70,7 @@ Data source for {{.ResourceNameAsDescription}}
{{- range .DocumentationParentDns }}
- {{ . }}
{{- end }}
- Default: `{{ getDefaultValues .PkgName "parent_dn" $.Definitions}}`
{{- end }}

### Read-Only ###
Expand Down
4 changes: 2 additions & 2 deletions gen/templates/datasource_example.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ data "aci_{{$.ResourceName}}" "example" {
{{- if eq $testType "cloud"}}
// This example is only applicable to Cisco Cloud Network Controller
{{- end}}
data "aci_{{ $topContext.ResourceName }}" {{- if ne $formatValue.ContainedBy "default"}}"example_{{ getResourceName $formatValue.ContainedBy $topContext.Definitions }}"{{- else}}"example"{{- end }} {
{{- if ne $formatValue.ContainedBy "default"}}
data "aci_{{ $topContext.ResourceName }}" {{- if ne $formatValue.ContainedBy ""}}"example_{{ getResourceName $formatValue.ContainedBy $topContext.Definitions }}"{{- else}}"example"{{- end }} {
{{- if ne $formatValue.ContainedBy ""}}
parent_dn = {{createParentDnValue $formatValue.ContainedBy "example" $topContext.Definitions}}
{{- end }}
{{- range $topContext.Properties }}
Expand Down
10 changes: 5 additions & 5 deletions gen/templates/datasource_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (

{{- if .parents}}
{{- range .parents}}
func TestAccDataSource{{$.resourceClassName}}With{{capitalize .class_name}} (t *testing.T) {
func TestAccDataSource{{$.resourceClassName}}{{if .class_name}}With{{capitalize .class_name}}{{end}} (t *testing.T) {

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t, "{{.test_type}}", "{{.test_applicable_from_version}}") },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: testConfig{{$.resourceClassName}}DataSourceDependencyWith{{capitalize .class_name}} ,
Config: testConfig{{$.resourceClassName}}DataSource{{if .class_name}}DependencyWith{{capitalize .class_name}}{{end}} ,
ExpectNonEmptyPlan: {{.class_in_parent}},
Check: resource.ComposeAggregateTestCheckFunc(
{{- if $found_cert }}
Expand All @@ -50,7 +50,7 @@ func TestAccDataSource{{$.resourceClassName}}With{{capitalize .class_name}} (t *
),
},
{
Config: testConfig{{$.resourceClassName}}NotExisting{{capitalize .class_name}},
Config: testConfig{{$.resourceClassName}}NotExisting{{if .class_name}}{{capitalize .class_name}}{{end}},
{{- if $found_cert }}
Check: resource.ComposeAggregateTestCheckFunc(
waitForApicBeforeRefresh,
Expand Down Expand Up @@ -113,7 +113,7 @@ func TestAccDataSource{{.resourceClassName}}(t *testing.T) {

{{- if .parents}}
{{- range .parents}}
const testConfig{{$.resourceClassName}}DataSourceDependencyWith{{capitalize .class_name}} = testConfig{{$.resourceClassName}}MinDependencyWith{{capitalize .class_name}} + `
const testConfig{{$.resourceClassName}}DataSource{{if .class_name}}DependencyWith{{capitalize .class_name}}{{end}} = testConfig{{$.resourceClassName}}Min{{if .class_name}}DependencyWith{{capitalize .class_name}}{{end}} + `
data "aci_{{$.resourceName}}" "test" {
{{- if ne .parent_dn ""}}
parent_dn = {{.parent_dn}}
Expand All @@ -129,7 +129,7 @@ data "aci_{{$.resourceName}}" "test" {
}
`

const testConfig{{$.resourceClassName}}NotExisting{{capitalize .class_name}} = testConfig{{$.resourceClassName}}MinDependencyWith{{capitalize .class_name}} + `
const testConfig{{$.resourceClassName}}NotExisting{{if .class_name}}{{capitalize .class_name}}{{end}} = testConfig{{$.resourceClassName}}Min{{if .class_name}}DependencyWith{{capitalize .class_name}}{{end}} + `
data "aci_{{$.resourceName}}" "test_non_existing" {
{{- if ne .parent_dn ""}}
parent_dn = {{.parent_dn}}
Expand Down
4 changes: 2 additions & 2 deletions gen/templates/resource_example.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ resource "aci_{{$.ResourceName}}" "example" {
{{- if eq $testType "cloud"}}
// This example is only applicable to Cisco Cloud Network Controller
{{- end}}
resource "aci_{{$topContext.ResourceName}}" {{- if ne $formatValue.ContainedBy "default"}} "example_{{ getResourceName $formatValue.ContainedBy $topContext.Definitions }}" {{- else}} "example" {{- end }} {
{{- if ne $formatValue.ContainedBy "default"}}
resource "aci_{{$topContext.ResourceName}}" {{- if ne $formatValue.ContainedBy ""}} "example_{{ getResourceName $formatValue.ContainedBy $topContext.Definitions }}" {{- else}} "example" {{- end }} {
{{- if ne $formatValue.ContainedBy ""}}
parent_dn = {{ createParentDnValue $formatValue.ContainedBy "example" $topContext.Definitions }}
{{- end }}
{{- range $topContext.Properties }}
Expand Down
4 changes: 2 additions & 2 deletions gen/templates/resource_example_all_attributes.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ resource "aci_{{$.ResourceName}}" "full_example" {
{{- if eq $testType "cloud"}}
// This example is only applicable to Cisco Cloud Network Controller
{{- end}}
resource "aci_{{$topContext.ResourceName}}" {{- if ne $formatValue.ContainedBy "default"}}"full_example_{{ getResourceName $formatValue.ContainedBy $topContext.Definitions }}"{{- else}}"full_example"{{- end }} {
{{- if ne $formatValue.ContainedBy "default"}}
resource "aci_{{$topContext.ResourceName}}" {{- if ne $formatValue.ContainedBy ""}}"full_example_{{ getResourceName $formatValue.ContainedBy $topContext.Definitions }}"{{- else}}"full_example"{{- end }} {
{{- if ne $formatValue.ContainedBy ""}}
parent_dn = {{createParentDnValue $formatValue.ContainedBy "example" $topContext.Definitions}}
{{- end }}
{{- range $topContext.Properties }}
Expand Down
Loading

0 comments on commit f540fe4

Please sign in to comment.