Skip to content

Commit

Permalink
[ignore] Fix examples for target_dns in data-sources
Browse files Browse the repository at this point in the history
  • Loading branch information
akinross committed Jul 2, 2024
1 parent 7d7be7a commit 230b9de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/data-sources/relation_to_contract_master.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ Data source for Relation To Contract Master
data "aci_relation_to_contract_master" "example_application_epg" {
parent_dn = aci_application_epg.example.id
target_dn = aci_endpoint_security_group.example.id
target_dn = aci_application_epg.example_2.id
}
data "aci_relation_to_contract_master" "example_endpoint_security_group" {
parent_dn = aci_endpoint_security_group.example.id
target_dn = aci_endpoint_security_group.example.id
target_dn = aci_endpoint_security_group.example_2.id
}
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

data "aci_relation_to_contract_master" "example_application_epg" {
parent_dn = aci_application_epg.example.id
target_dn = aci_endpoint_security_group.example.id
target_dn = aci_application_epg.example_2.id
}

data "aci_relation_to_contract_master" "example_endpoint_security_group" {
parent_dn = aci_endpoint_security_group.example.id
target_dn = aci_endpoint_security_group.example.id
target_dn = aci_endpoint_security_group.example_2.id
}
11 changes: 8 additions & 3 deletions gen/templates/datasource_example.tf.tmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{{- if .DocumentationExamples}}{{- range $key := .DocumentationExamples}}
{{- if .DocumentationExamples}}{{$parentIndex := 0}}{{- range $key := .DocumentationExamples}}
data "aci_{{$.ResourceName}}" "example_{{getResourceName $key $.Definitions}}" {
{{- if $.HasParent}}
parent_dn = {{createParentDnValue $key "example" $.Definitions}}
{{- end}}
{{- range $.Properties}}{{- if .IsNaming}}{{- if ne .NamedPropertyClass ""}}
{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}} = aci_{{getResourceName .NamedPropertyClass $.Definitions}}.example.name
{{- else if eq .SnakeCaseName "t_dn" }}
{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}} = {{lookupTestValue .PkgName .SnakeCaseName $.TestVars $.Definitions | replace ".test_0.id" ".example.id"}}
{{- else if eq .SnakeCaseName "t_dn" }}{{$attributeKey := overwriteProperty .PkgName .SnakeCaseName $.Definitions}}
{{- range $index, $testParent := $.TestVars.parents }}
{{- if eq $index $parentIndex }}
{{$attributeKey}} = {{getTestTargetDn $.TestVars.targets $.TestVars.resourceName "" true $testParent.target_classes $index | replace "test" "example" | replace "_0" "" | replace "_1" "_2" }}
{{- $parentIndex = add $parentIndex 1 }}{{- break}}
{{- end}}
{{- end}}
{{- else}}
{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}} = "{{lookupTestValue .PkgName .SnakeCaseName $.TestVars $.Definitions}}"{{- end}}{{- end}}
{{- end}}
Expand Down

0 comments on commit 230b9de

Please sign in to comment.