From 5262327c0177b7a201299fc762fcd9fc75f71fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin=20ARDAL?= Date: Sat, 9 Oct 2021 02:42:26 +0200 Subject: [PATCH] feat: add pre-commit and terraform-docs --- .pre-commit-config.yaml | 11 ++++++++--- .terraform.lock.hcl | 26 +++++++++++++------------- CHANGELOG.md | 18 ++++++++++++++++-- README.md | 20 -------------------- debug.log | 8 ++++++++ files/bootstrap.sh | 23 ++++++++++++++++++++++- release-notes/relnote-v0.2.0.md | 2 +- release-notes/relnote-v0.3.0.md | 2 +- release-notes/relnote-v0.4.0.md | 13 +++++++++++++ 9 files changed, 82 insertions(+), 41 deletions(-) create mode 100644 debug.log create mode 100644 release-notes/relnote-v0.4.0.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c760fcd..3c422c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,19 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases + rev: v4.0.1 # Get the latest from: https://github.com/pre-commit/pre-commit-hooks/releases hooks: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.45.0 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases + rev: v1.52.0 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases hooks: - id: terraform_validate - - id: terraform_docs + # - id: terraform_docs - id: terraform_fmt +- repo: https://github.com/terraform-docs/terraform-docs + rev: v0.16.0 + hooks: + - id: terraform-docs-system + args: ["--output-file", "README.md", "."] ... \ No newline at end of file diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl index a6db1c6..4483e21 100644 --- a/.terraform.lock.hcl +++ b/.terraform.lock.hcl @@ -2,19 +2,19 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/oci" { - version = "4.46.0" - constraints = ">= 3.27.0, >= 4.40.0" + version = "4.47.0" + constraints = ">= 3.27.0, >= 4.40.0, >= 4.41.0" hashes = [ - "h1:hGf+fTM5wlNzvB6qI70r9FMEq1P4dM4ZfG8QJ6nJ7MQ=", - "zh:05bca775a6cb8534d0edec24985d2dfbfe07cd54d05db5721efd7755ef7c1b94", - "zh:0e3dc9141bdf7109d6badf92b47c356d1be63502046c485c3c2629a7aeae292a", - "zh:22380194af49add69325bd069b3b56f48f280d6258a8e3ebe1a4fd78c05e3879", - "zh:3a7f9ffb14b6f56b1c2cdf0c6ac3d4e3399eee00a511bb9d4b36c35e4065f335", - "zh:636ac0f2f223bd917a728ef2a48f2d1f88f73e720f62029e3b82aa07dfe00aa9", - "zh:7658b355f2d2fe09b0ea523041c7edb69e747926464320a6f2b9e6fa549fa046", - "zh:923fb093d970baffaf67033dbc07673eb15f3f7b49bc05b7714f587de6f0f086", - "zh:da37df79a8b20fec53971bd9e87b2185c47bcc6817707bd1a28a89d19391ca46", - "zh:f09d3c284799da5b35e7f25850eac21bf112aa46a8674690dbf5af343c072dc2", - "zh:fd0859e5a92eb68fdc371ad7ff5f0305c47cb3ca2f0072bb939263c38618e793", + "h1:Sm3fgdZWQDq51CKUHWcCeOaYszMywbnzxav1q/QCaTo=", + "zh:1161eb7a1a03eca15787bf9a202132d15dd2cabed3872757016391c06c87b075", + "zh:2406b5b17aa93c5751eedc4b34445815d5ec4e86906cc86ed58e6053d7f39453", + "zh:27891206e8377644257700d042987d476a80a46ef5ffeb8237d5155bede6614a", + "zh:4e2208f1e953f46cd6485a14d6af67d8e8fe182e26d1c2fc435145b35d86d3e9", + "zh:5f3a6bac570bb70349f72e695b94d3719a5609127aef4c80ec695bd827dd6d30", + "zh:5f4229d16ca4fd90e90c8d02e14053750b16001c98fa64129a9e31f0796d55f7", + "zh:b0ebdc62ca99e7a63ce0202b8b19ea1e53bab8cfa14a3951dd402df04584e8aa", + "zh:b9385802ceee8260889676bc0a30078789d175633e3ea2ade017156cad380b6f", + "zh:c2a33b8f678ab1020efebc415aad6de181de3705d1d554995642c659f048f5bc", + "zh:c57679a0269c7a9386a973be438610fec8e9fba21a088548b1f0213893693c0a", ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d3d227..6e07124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,25 @@ Given a version number MAJOR.MINOR.PATCH: - MINOR version when adding functionality in a backwards compatible manner, - PATCH version when making backwards compatible bug fixes. +## [0.4.0] - 2021-10-09 + +### Added + +Bootstrap.sh installs new programming language and tools: + +- Go 1.17.2 +- pre-commit 2.15.0 : A framework for managing and maintaining multi-language Git pre-commit hooks. +- terraform-docs 0.16.0 : Generate Terraform modules documentation in various formats + +### Changed + +- pre-commit now use the official hook from the terraform-docs Github repo + ## [0.3.0] - 2021-10-08 ### Added -- Reserved Public IP +- add a reserved Public IP to instance ## [0.2.1] - 2021-10-08 @@ -45,4 +59,4 @@ Deploys a vcn with a public subnet, and a Linux 8 instance on ARM. The instance - Packer - Ansible, oracle.oci collection and usefull roles - oci-cli -- Python virtualenvwrapper, oci sdk +- Python virtualenvwrapper, oci sdkx diff --git a/README.md b/README.md index c848f09..f96110b 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,3 @@ -# IACBOX - -## Table of Contents - -1. [About](#about) -2. [Requirements](#requirements) -3. [Providers](#Providers) -4. [Inputs](#inputs) -5. [Outputs](#outputs) - -## About - -This module deploys an instance with the necessary tools to start developing Infrastructure as Code solutions on OCI: - -- Terraform -- Packer -- Ansible and specific roles -- oci-cli -- Python virtualenvwrapper, oci sdk - ## Requirements diff --git a/debug.log b/debug.log new file mode 100644 index 0000000..5bb5428 --- /dev/null +++ b/debug.log @@ -0,0 +1,8 @@ +2021-10-09 02:09:35 (49.9 MB/s) - ‘go1.17.2.linux-arm64.tar.gz’ saved [102615093/102615093] + +go env: cannot find go env config: neither $XDG_CONFIG_HOME nor $HOME are defined +missing $GOPATH +Cloud-init v. 20.3-10.0.1.el8_4.5 running 'modules:final' at Sat, 09 Oct 2021 02:07:28 +0000. Up 28.54 seconds. +2021-10-09 02:09:45,002 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts) +2021-10-09 02:09:45,003 - util.py[WARNING]: Running module scripts-user () failed +Cloud-init v. 20.3-10.0.1.el8_4.5 finished at Sat, 09 Oct 2021 02:09:45 +0000. Datasource DataSourceOracle. Up 166.46 seconds \ No newline at end of file diff --git a/files/bootstrap.sh b/files/bootstrap.sh index 86660d9..b9b9e58 100644 --- a/files/bootstrap.sh +++ b/files/bootstrap.sh @@ -31,7 +31,9 @@ ansible-galaxy collection install oracle.oci ansible-galaxy role install cimon-io.systemd-service # Python tooling -## update pip +## update setuptools, wheel and pip +dnf install platform-python-devel.aarch64 -y # required by pre-commit +python -m pip install setuptools wheel --upgrade # required by pre-commit python -m pip install pip --upgrade ## install and configure virtualenvwrapper @@ -44,3 +46,22 @@ python -m pip install virtualenvwrapper --upgrade ## install global packages python -m pip install oci oci-cli --upgrade +python -m pip install pre-commit --upgrade + +# install Go globally +## required to install terraform-docs as there is no pre-build arm64 binaries +## install Go from Golang.org as OL8 currently only distribute Go 1.15 +GO_PACKAGE="go1.17.2.linux-arm64.tar.gz" +wget "https://golang.org/dl/$GO_PACKAGE" +rm -rf /usr/local/go && tar -C /usr/local -xzf "$GO_PACKAGE" +echo "PATH=$PATH:/usr/local/go/bin" >> /etc/environment +rm -rf "$GO_PACKAGE" + +{ + echo "#!/bin/sh" + echo "sudo /usr/local/go/bin/go env -w GOBIN=/usr/local/bin" + echo "sudo /usr/local/go/bin/go install github.com/terraform-docs/terraform-docs@v0.16.0" +} >> $HOME_FOLDER/install_terraform-docs.sh + +chmod +X $HOME_FOLDER/install_terraform-docs.sh +$HOME_FOLDER/install_terraform-docs.sh diff --git a/release-notes/relnote-v0.2.0.md b/release-notes/relnote-v0.2.0.md index 0aaea3d..271eb30 100644 --- a/release-notes/relnote-v0.2.0.md +++ b/release-notes/relnote-v0.2.0.md @@ -4,6 +4,6 @@ Bumped Compute module to v2.2.0-RC1 -### New features +## New features Terraform Cloud compatibility: this repo can be linked to a Terraform Cloud workspace for automatic `apply`on commit. diff --git a/release-notes/relnote-v0.3.0.md b/release-notes/relnote-v0.3.0.md index c5a461a..8ea4cbb 100644 --- a/release-notes/relnote-v0.3.0.md +++ b/release-notes/relnote-v0.3.0.md @@ -2,4 +2,4 @@ ## Changes -Reserved Public IP +add a reserved Public IP to instance diff --git a/release-notes/relnote-v0.4.0.md b/release-notes/relnote-v0.4.0.md new file mode 100644 index 0000000..3d02fdc --- /dev/null +++ b/release-notes/relnote-v0.4.0.md @@ -0,0 +1,13 @@ +# 2021-10-09 + +## New features + +`Bootstrap.sh` installs new programming language and tooling: + +- Go 1.17.2 +- pre-commit 2.15.0 : A framework for managing and maintaining multi-language Git pre-commit hooks. +- terraform-docs 0.16.0 : Generate Terraform modules documentation in various formats + +## Changes + +pre-commit now use the official hook from the terraform-docs Github repo.