Skip to content

Commit

Permalink
Github workflows and tf-docs formatter added
Browse files Browse the repository at this point in the history
  • Loading branch information
Keren Trajtenberg committed Jan 10, 2024
1 parent fbe0257 commit 13cb3a1
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) NetApp, Inc.
# SPDX-License-Identifier: Apache-2.0

name: "Documentation: terraform-docs"

on:
pull_request:

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout pull request
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Render documentation and push changes back to branch
uses: terraform-docs/[email protected]
with:
config-file: ".terraform-docs.yml"
output-file: "README.md"
output-method: inject
git-push: true
41 changes: 41 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) NetApp, Inc.
# SPDX-License-Identifier: Apache-2.0

name: "Code Quality: Terraform"

on:
pull_request:
push:
branches:
- main

jobs:
terraform:
name: Terraform
runs-on: ubuntu-latest

steps:
- name: Checkout pull request
uses: actions/[email protected]
with:
fetch-depth: 1
ref: ${{ github.event.pull_request.head.ref }}

- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: false
terraform_version: 1.6.6

- name: Initialize Terraform
run: terraform init

- name: Format Terraform configuration
run: terraform fmt -diff -check -no-color -recursive

- name: Validate Terraform configuration
run: terraform validate

- name: Lint Terraform configuration
run: curl -sSfL https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | sh
tflint
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
terraform_deployment/.terraform
terraform_deployment/.terraform.lock.hcl
terraform_deployment/.terraform*
terraform_deployment/terraform.tfstate*
88 changes: 88 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Copyright (c) NetApp, Inc.
# SPDX-License-Identifier: Apache-2.0

---

# see https://terraform-docs.io/user-guide/configuration/formatter/
formatter: "markdown table"

# see https://terraform-docs.io/user-guide/configuration/output/
output:
file: "README.md"
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
# see https://terraform-docs.io/user-guide/configuration/settings/
settings:
anchor: false
color: true
default: true
escape: false
indent: 3
required: true
sensitive: true
type: true

# see https://terraform-docs.io/user-guide/configuration/sort/
sort:
enabled: true
by: required

# see https://terraform-docs.io/user-guide/configuration/sections/
sections:
show:
- providers
- inputs
- outputs

content: |
## Table of Contents
* [Introduction](#introduction)
* [Prerequisites](#prerequisites)
* [Getting Started](#getting-started)
* [Usage Examples](#usage-examples)
* [Author Information](#author-information)
* [License](#license)
## Introduction
<< place your description here >>
##Prerequisites
{{ .Providers}}
### Repository Overview
{{ .Inputs }}
{{ .Outputs }}
## Getting Started
<< place your instructions here >>
## Usage Examples
<< place your examples here >>
## Author Information
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSxN-Samples/graphs/contributors).
## License
Licensed under the Apache License, Version 2.0 (the "License").
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an _"AS IS"_ basis, without WARRANTIES or conditions of any kind, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
# see https://terraform-docs.io/user-guide/configuration/version/
version: ">= 0.16.0, < 1.0.0"

0 comments on commit 13cb3a1

Please sign in to comment.