Makes sure provided content block is inside the specified file.
NOTE
The logic uses a very primitive approach. Do NOT use with large files.
-
view initial
config.ymlcontent:$ cat config.yml image: nginx:latest
-
run
blockinfile:blockinfile -path config.yml -content 'name: app' -
examine content:
$ cat config.yml image: nginx:latest # BEGIN MANAGED BLOCK name: app # END MANAGED BLOCK
-
run
blockinfileagain:blockinfile -path config.yml -content 'name: server' -
examine updated content:
$ cat config.yml image: nginx:latest # BEGIN MANAGED BLOCK name: server # END MANAGED BLOCK
terraform-docs markdown table . | blockinfile -path README.md -marker '# {{ .Mark }} TERRAFORM DOCS' -content -