Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
QBY-EstebanValverde authored Aug 24, 2023
0 parents commit f737eb4
Show file tree
Hide file tree
Showing 12 changed files with 311 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2",
"language": "en",
"ignorePaths": [
"**/node_modules/**",
"**/vscode-extension/**",
"**/.git/**",
"**/.pnpm-lock.json",
".vscode",
"package-lock.json",
"megalinter-reports",
".gitignore"
],
"words": [
"Subfolders",
"azurerm",
"fullspec",
"jsondecode",
"jsonencode",
"postcondition",
"qbeyond",
"regexall",
"setsubtract",
"setunion",
"tflint",
"toset"
]
}
25 changes: 25 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Documentation
on:
pull_request:
branches:
- main
push:
branches:
- main

permissions: {}

jobs:
docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Render terraform docs and push changes back to PR
uses: terraform-docs/gh-actions@main
with:
config-file: .terraform-docs.yml
git-push: true
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Created by https://www.toptal.com/developers/gitignore/api/terraform,visualstudiocode
# Edit at https://www.toptal.com/developers/gitignore?templates=terraform,visualstudiocode

### Terraform ###
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# Support for Project snippet scope
.vscode/*.code-snippets

# Ignore code-workspaces
*.code-workspace

# End of https://www.toptal.com/developers/gitignore/api/terraform,visualstudiocode

# ignore megalinter results
megalinter-reports/
101 changes: 101 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
formatter: "markdown"

# Tested with this version
# As major version is 0 any change may break
version: ">=0.16.0"

sections:
hide:
- header
- providers

output:
file: "README.md"
mode: inject

sort:
enabled: true
by: required

content: |-
{{- define "setDict" -}}
{{- $resource := list -}}
{{- if hasKey .Dict .Key -}}
{{- $resource = get .Dict .Key -}}
{{- else -}}
{{- $resource = list -}}
{{- end -}}
{{- $resource := append $resource .Resource -}}
{{- $_ := set .Dict .Key $resource -}}
{{- end -}}
{{- $filesResources := dict -}}
{{- $resourceTypes := dict -}}
{{- range .Module.Resources -}}
{{- template "setDict" dict "Dict" $filesResources "Key" .Position.Filename "Resource" . -}}
{{- $isResource := eq "resource" (printf "%s" .GetMode) -}}
{{- if $isResource -}}
{{- template "setDict" dict "Dict" $resourceTypes "Key" (printf "%s_%s" .ProviderName .Type) "Resource" . -}}
{{- end -}}
{{- end -}}
{{ indent 0 "#" }} Usage
It's very easy to use!
```hcl
{{ include "examples/basic/main.tf" }}
```
{{ .Requirements }}
{{ .Providers }}
{{ .Inputs }}
{{ .Outputs }}
{{ if .Config.Sections.Resources -}}
{{- if not (keys $resourceTypes) -}}
{{- if not .Config.Settings.HideEmpty -}}
{{- indent 0 "#" }} Resource types
No resources.
{{ end }}
{{ else }}
{{ indent 0 "#" }} Resource types
| Type | Used |
|------|-------|
{{- range $type,$resources := $resourceTypes }}
{{- $url := (first $resources).URL -}}
{{- $type = ternary $url (printf "[%s](%s)" $type $url) $type }}
| {{ $type }} | {{ len $resources }} |
{{- end }}
**`Used` only includes resource blocks.** `for_each` and `count` meta arguments, as well as resource blocks of modules are not considered.
{{ end }}
{{ end -}}
{{ .Modules }}
{{ if or .Config.Sections.Resources .Config.Sections.DataSources -}}
{{- if not (keys $filesResources) -}}
{{- if not .Config.Settings.HideEmpty -}}
{{ indent 0 "#" }} Resources by Files
No resources.
{{ end }}
{{ else }}
{{ indent 0 "#" }} Resources by Files
{{- range $fileName,$resources := $filesResources }}
{{ indent 1 "#" }} {{ $fileName }}
| Name | Type |
|------|------|
{{- range $resources -}}
{{- $isResource := and $.Config.Sections.Resources ( eq "resource" (printf "%s" .GetMode)) }}
{{- $isDataResource := and $.Config.Sections.DataSources ( eq "data source" (printf "%s" .GetMode)) }}
{{- if or $isResource $isDataResource }}
{{- $fullspec := ternary .URL (printf "[%s](%s)" .Spec .URL) .Spec }}
| {{ $fullspec }} | {{ .GetMode }} |
{{- end }}
{{- end -}}
{{- end }}
{{ end }}
{{- end -}}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 q.beyond AG

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Module
[![GitHub tag](https://img.shields.io/github/tag/qbeyond/terraform-module-template.svg)](https://registry.terraform.io/modules/qbeyond/terraform-module-template/provider/latest)
[![License](https://img.shields.io/github/license/qbeyond/terraform-module-template.svg)](https://github.com/qbeyond/terraform-module-template/blob/main/LICENSE)

----

This is a template module. It just showcases how a module should look. This would be a short description of the module.

<!-- BEGIN_TF_DOCS -->
## Usage

It's very easy to use!
```hcl
provider "azurerm" {
features {
}
}
```

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >= 3.7.0 |

## Inputs

No inputs.
## Outputs

No outputs.
## Resource types

No resources.


## Modules

No modules.
## Resources by Files

No resources.

<!-- END_TF_DOCS -->

## Contribute

Please use Pull requests to contribute.

When a new Feature or Fix is ready to be released, create a new Github release and adhere to [Semantic Versioning 2.0.0](https://semver.org/lang/de/spec/v2.0.0.html).
5 changes: 5 additions & 0 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "azurerm" {
features {

}
}
3 changes: 3 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {

}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file added outputs.tf
Empty file.
8 changes: 8 additions & 0 deletions terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.7.0"
}
}
}
Empty file added variables.tf
Empty file.

0 comments on commit f737eb4

Please sign in to comment.