Skip to content

Commit

Permalink
Generate descriptions for maps and lists in terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
kklimonda-cl committed Aug 30, 2024
1 parent f6fdfe0 commit 0ff9005
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/golangci/golangci-lint/
rev: v1.59.1
rev: v1.60.3
hooks:
- id: golangci-lint
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
4 changes: 4 additions & 0 deletions pkg/translate/terraform_provider/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,7 @@ func createSchemaSpecForNormalization(resourceTyp properties.ResourceType, schem
const renderSchemaTemplate = `
{{- define "renderSchemaListAttribute" }}
"{{ .Name.Underscore }}": {{ .Package }}.{{ .SchemaType }} {
Description: "{{ .Description }}",
Required: {{ .Required }},
Optional: {{ .Optional }},
Computed: {{ .Computed }},
Expand All @@ -1303,6 +1304,7 @@ const renderSchemaTemplate = `
{{- define "renderSchemaMapAttribute" }}
"{{ .Name.Underscore }}": {{ .Package }}.{{ .SchemaType }} {
Description: "{{ .Description }}",
Required: {{ .Required }},
Optional: {{ .Optional }},
Computed: {{ .Computed }},
Expand All @@ -1314,6 +1316,7 @@ const renderSchemaTemplate = `
{{- define "renderSchemaListNestedAttribute" }}
{{- with .Attribute }}
"{{ .Name.Underscore }}": {{ .Package }}.{{ .SchemaType }} {
Description: "{{ .Description }}",
Required: {{ .Required }},
Optional: {{ .Optional }},
Computed: {{ .Computed }},
Expand Down Expand Up @@ -1386,6 +1389,7 @@ const renderSchemaTemplate = `
func {{ .StructName }}Schema() {{ .Package }}.{{ .ReturnType }} {
return {{ .Package }}.{{ .ReturnType }}{
{{- if not (or (eq .ReturnType "Schema") (eq .ReturnType "NestedAttributeObject")) }}
Description: "{{ .Description }}",
Required: {{ .Required }},
Computed: {{ .Computed }},
Optional: {{ .Optional }},
Expand Down

0 comments on commit 0ff9005

Please sign in to comment.