Skip to content

Commit

Permalink
feat: add pre-commit and terraform-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kral2 committed Oct 9, 2021
1 parent 333fd6d commit 5262327
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 41 deletions.
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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", "."]
...
26 changes: 13 additions & 13 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

<!-- BEGIN_TF_DOCS -->

## Requirements
Expand Down
8 changes: 8 additions & 0 deletions debug.log
Original file line number Diff line number Diff line change
@@ -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 (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3.6/site-packages/cloudinit/config/cc_scripts_user.py'>) 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
23 changes: 22 additions & 1 deletion files/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/[email protected]"
} >> $HOME_FOLDER/install_terraform-docs.sh

chmod +X $HOME_FOLDER/install_terraform-docs.sh
$HOME_FOLDER/install_terraform-docs.sh
2 changes: 1 addition & 1 deletion release-notes/relnote-v0.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion release-notes/relnote-v0.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Changes

Reserved Public IP
add a reserved Public IP to instance
13 changes: 13 additions & 0 deletions release-notes/relnote-v0.4.0.md
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 5262327

Please sign in to comment.