Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Generate CloudFormation and Terraform docs files via AVD docs generator #878

Merged
merged 4 commits into from
Sep 7, 2022

Conversation

reedloden
Copy link
Contributor

Rather than rely on manual creation of CloudFormation.md and Terraform.md, generate them the same way as docs.md via the avd_generator program.

cmd/avd_generator/main.go Outdated Show resolved Hide resolved
cmd/avd_generator/main.go Outdated Show resolved Hide resolved
cmd/avd_generator/main.go Outdated Show resolved Hide resolved
cmd/avd_generator/main.go Outdated Show resolved Hide resolved
cmd/avd_generator/main.go Outdated Show resolved Hide resolved
@reedloden
Copy link
Contributor Author

To be clear, this is not yet working properly. Just wanted to push this up for comments. Once it's working correctly, I'll regenerate all the files and include in this PR (unless that should be done as a separate PR after this change lands).

@owenrumney
Copy link
Contributor

Hey @reedloden - I didn't want to push directly to your branch so here is the result of some fiddling... thanks for doing this, needed doing

Terraform Template

var terraformMarkdownTemplate = `
{{ .Resolution }}

{{ if .Terraform.GoodExamples }}{{ range .Terraform.GoodExamples }}` + "```hcl" + `{{ . }}
` + "```" + `
{{ end}}{{ end }}
{{ if .Terraform.Links }}#### Remediation Links{{ range .Terraform.Links }}
 - {{ . }}
{{ end}}{{ end }}
`

CloudFormation Template

var cloudformationMarkdownTemplate = `
{{ .Resolution }}

{{ if .CloudFormation.GoodExamples }}{{ range .CloudFormation.GoodExamples }}` + "```yaml" + `{{ . }}
` + "```" + `
{{ end}}{{ end }}
{{ if .CloudFormation.Links }}#### Remediation Links{{ range .CloudFormation.Links }}
 - {{ . }}
{{ end}}{{ end }}
`

@reedloden reedloden force-pushed the reed/avd_docs_gen_tf_cf branch from dea5d39 to 31a27d8 Compare August 19, 2022 09:23
@reedloden
Copy link
Contributor Author

@owenrumney Thanks! I had to make a slight tweak to the CloudFormation template, as the --- kept getting put right next to the yaml, but otherwise, works great. I've updated my branch and also ran make docs. Let me know if you'd prefer the docs be handled in a separate PR.

@reedloden
Copy link
Contributor Author

I do see some cases where the existing docs may have been slightly better. I'm a bit time-constrained right now to go through each one, but feel free to make any necessary changes and push to my branch.

reedloden and others added 3 commits September 7, 2022 10:25
…enerator

Rather than rely on manual creation of `CloudFormation.md` and `Terraform.md`,
generate them the same way as `docs.md` via the `avd_generator` program.
@owenrumney
Copy link
Contributor

Hey @reedloden - I've been away on hols, I'll look at this today and just push it. Thanks for the efforts

@owenrumney owenrumney force-pushed the reed/avd_docs_gen_tf_cf branch from 9fb65d9 to 378209f Compare September 7, 2022 09:32
@owenrumney owenrumney merged commit f921846 into aquasecurity:master Sep 7, 2022
@reedloden reedloden deleted the reed/avd_docs_gen_tf_cf branch September 7, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants