Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: structure #13

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
version: 2

updates:
- package-ecosystem: gomod
directory: /tests
schedule:
interval: daily
- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: daily
4 changes: 3 additions & 1 deletion .github/policies/avmrequiredfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ configuration:
repository. A pull request has been opened to add the
missing files. When the pr is merged this issue will be
closed automatically.
prTitle: 'feat: add AVM mandatory file(s) to this repo'
prTitle: "feat: add AVM mandatory file(s) to this repo"
prBody: |
This repository needs the standard workflow and policy files to ensure compliance.
file:
- path: .github/workflows/version-check.yml
prContentLink: https://raw.githubusercontent.com/Azure/terraform-azurerm-avm-template/main/.github/workflows/version-check.yml
- path: .github/workflows/docs-check.yml
prContentLink: https://raw.githubusercontent.com/Azure/terraform-azurerm-avm-template/main/.github/workflows/docs-check.yml
- path: .github/policies/avmrequiredfiles.yml
prContentLink: https://raw.githubusercontent.com/Azure/terraform-azurerm-avm-template/main/.github/policies/avmrequiredfiles.yml
- path: .github/policies/branchprotection.yml
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: docs-check

on:
pull_request:
types: ['opened', 'reopened', 'synchronize']
merge_group:
workflow_dispatch:

concurrency:
group: docsfmttest-${{ github.event.pull_request.head.repo.full_name }}/${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
docsfmttest:
name: docs-check
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '1.20.x'
# cache-dependency-path: tests/go.sum

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- name: Install tools
run: make tools

- name: Check fmt and docs
run: |
echo "==> Running make fmt & make docs"
make fmt
make docs
echo "==> Testing for changes to tracked files"
CHANGES=$(git status -suno)
if [ "$CHANGES" ]; then
echo "Repository formatting or documentation is not correct."
echo "Run 'make fmt && make docs' locally and commit the changes to fix."
exit 1
fi
1 change: 1 addition & 0 deletions .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: version-check

on:
workflow_dispatch:
merge_group:
pull_request:
branches:
- main
Expand Down
67 changes: 67 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
### To generate the output file to partially incorporate in the README.md,
### Execute this command in the Terraform module's code folder:
# terraform-docs -c .terraform-docs.yml .

formatter: "markdown document" # this is required

version: "0.16.0"

header-from: "_header.md"
footer-from: "_footer.md"

recursive:
enabled: false
path: modules

sections:
hide: []
show: []

content: |-
{{ .Header }}

<!-- markdownlint-disable MD033 -->
{{ .Requirements }}

{{ .Providers }}

{{ .Resources }}

<!-- markdownlint-disable MD013 -->
{{ .Inputs }}

{{ .Outputs }}

{{ .Modules }}

{{ .Footer }}

output:
file: README.md
mode: replace
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
output-values:
enabled: false
from: ""

sort:
enabled: true
by: required

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: true
read-comments: true
required: true
sensitive: true
type: true
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.PHONY: docs
docs:
terraform-docs -c .terraform-docs.yml .

.PHONY: fmt
fmt:
@echo "==> Fixing source code with gofmt..."
find ./tests -name '*.go' | grep -v vendor | xargs gofmt -s -w
@echo "==> Fixing Terraform code with terraform fmt..."
terraform fmt -recursive
@echo "==> Fixing embedded Terraform with terrafmt..."
find . | egrep ".md|.tf" | grep -v README.md | sort | while read f; do terrafmt fmt $$f; done

.PHONY: tools
tools:
go install github.com/katbyte/terrafmt@latest
go install github.com/terraform-docs/terraform-docs@latest
81 changes: 57 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,66 @@
# Project
<!-- BEGIN_TF_DOCS -->
# terraform-azurerm-avm-template

> This repo has been populated by an initial template to help get you started. Please
> make sure to update the content to build a great experience for community-building.
This is a template repo for Terraform Azure Verified Modules.

As the maintainer of this project, please make a few updates:
TODO: Provide instructions or links to spec to explain how to use this template.

- Improving this README.MD file to provide a great experience
- Updating SUPPORT.MD with content about this project's support experience
- Understanding the security reporting process in SECURITY.MD
- Remove this section from the README
<!-- markdownlint-disable MD033 -->
## Requirements

## Contributing
The following requirements are needed by this module:

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>= 1.0.0)

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 3.71.0)

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
## Providers

## Trademarks
The following providers are used by this module:

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
- <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) (>= 3.71.0)

- <a name="provider_random"></a> [random](#provider\_random)

## Resources

The following resources are used by this module:

- [azurerm_resource_group_template_deployment.telemetry](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group_template_deployment) (resource)
- [random_id.telemetry](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) (resource)

<!-- markdownlint-disable MD013 -->
## Required Inputs

The following input variables are required:

### <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name)

Description: The resource group where the resources will be deployed.

Type: `string`

## Optional Inputs

The following input variables are optional (have default values):

### <a name="input_enable_telemetry"></a> [enable\_telemetry](#input\_enable\_telemetry)

Description: This variable controls whether or not telemetry is enabled for the module.
For more information see https://aka.ms/avm/telemetry.
If it is set to false, then no telemetry will be collected.

Type: `bool`

Default: `true`

## Outputs

No outputs.

## Modules

No modules.


<!-- END_TF_DOCS -->
50 changes: 25 additions & 25 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# TODO: The maintainer of this repo has not yet edited this file
**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project?
- **No CSS support:** Fill out this template with information about how to file issues and get help.
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps.
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide.
*Then remove this first heading from this SUPPORT.MD file before publishing your repo.*
# Support
## How to file issues and get help
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
feature request as a new Issue.
For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER
CHANNEL. WHERE WILL YOU HELP PEOPLE?**.
## Microsoft Support Policy
Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
# TODO: The maintainer of this repo has not yet edited this file

**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project?

- **No CSS support:** Fill out this template with information about how to file issues and get help.
- **Yes CSS support:** Fill out an intake form at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). CSS will work with/help you to determine next steps.
- **Not sure?** Fill out an intake as though the answer were "Yes". CSS will help you decide.

*Then remove this first heading from this SUPPORT.MD file before publishing your repo.*

# Support

## How to file issues and get help

This project uses GitHub Issues to track bugs and feature requests. Please search the existing
issues before filing new issues to avoid duplicates. For new issues, file your bug or
feature request as a new Issue.

For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER
CHANNEL. WHERE WILL YOU HELP PEOPLE?**.

## Microsoft Support Policy

Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
File renamed without changes.
5 changes: 5 additions & 0 deletions _header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# terraform-azurerm-avm-template

This is a template repo for Terraform Azure Verified Modules.

TODO: Provide instructions or links to spec to explain how to use this template.
6 changes: 6 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Examples

Create a directory for each example.
Create a README.md file in each directory to help consumers understand the example.

> **Note:** Examples must be deployable and idempotent. Ensure that no input variables are requried to run the example and that random values are used to ensure unique resource names. E.g. use `random_pet` to generate a unique name for a resource.
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: insert locals here.
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: insert resources here.
4 changes: 4 additions & 0 deletions modules/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sub-modules

Create directories for each sub-module if required.
README.md files will be automatically generated for each sub-module using `terraform-docs`.
1 change: 1 addition & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: insert outputs here.
10 changes: 10 additions & 0 deletions terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">= 1.0.0"
required_providers {
# TODO: Ensure all required providers are listed here.
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.71.0"
}
}
}
3 changes: 3 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tests

Create tests in the provided subdirectories.
1 change: 1 addition & 0 deletions tests/unit/unit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package unit
Loading