Skip to content

Commit

Permalink
feat: auto generated docs and refine makefile (#62)
Browse files Browse the repository at this point in the history
Co-authored-by: dkool <dkool@dkools-MacBook-Pro.local>
  • Loading branch information
dkooll and dkool authored Oct 11, 2024
1 parent c288f14 commit 0011e7d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 24 deletions.
32 changes: 30 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
.PHONY: test
.PHONY: test docs fmt validate install-tools

export EXAMPLE

all: install-tools validate fmt docs

install-tools:
@go install github.com/terraform-docs/terraform-docs@latest

test:
cd tests && go test -v -timeout 60m -run TestApplyNoError/$(EXAMPLE) ./vwan_test.go
cd tests && go test -v -timeout 60m -run TestApplyNoError/$(EXAMPLE) ./deploy_test.go

docs:
@echo "Generating documentation for root and modules..."
@BASE_DIR=$$(pwd); \
terraform-docs markdown . --output-file $$BASE_DIR/README.md --output-mode inject --hide modules; \
for dir in $$BASE_DIR/modules/*; do \
if [ -d "$$dir" ]; then \
echo "Processing $$dir..."; \
terraform-docs markdown $$dir --output-file $$dir/README.md --output-mode inject --hide modules || echo "Skipped: $$dir"; \
fi \
done

fmt:
terraform fmt -recursive

validate:
terraform init -backend=false
terraform validate
@echo "Cleaning up initialization files..."
@rm -rf .terraform
@rm -f terraform.tfstate
@rm -f terraform.tfstate.backup
@rm -f .terraform.lock.hcl
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,46 +31,47 @@ End-to-end testing is not conducted on these modules, as they are individual com
- vpn gateway support on virtual hubs with multi-site and link connectivity
- ability to configure multiple vpn gateway connections on sites

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | ~> 4.3 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | ~> 4.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 4.3 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 4.0 |

## Resources

| Name | Type |
|------|------|
| [azurerm_virtual_hub](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_hub) | resource |
| [azurerm_virtual_wan](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_wan) | resource |
| [azurerm_vpn_gateway](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/vpn_gateway) | resource |
| [azurerm_vpn_gateway_connection](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/vpn_gateway_connection) | resource |
| [azurerm_vpn_site](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/vpn_site) | resource |
| [azurerm_virtual_hub_routing_intent](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_hub_routing_intent) | resource |
| [azurerm_virtual_hub.vhub](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_hub) | resource |
| [azurerm_virtual_wan.vwan](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_wan) | resource |
| [azurerm_vpn_gateway.vpn_gateway](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/vpn_gateway) | resource |
| [azurerm_vpn_gateway_connection.vpn_connection](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/vpn_gateway_connection) | resource |
| [azurerm_vpn_site.vpn_site](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/vpn_site) | resource |

## Inputs

| Name | Description | Type | Required |
| :-- | :-- | :-- | :-- |
| `vwan` | describes virtual wan configuration | object | yes |
| `naming` | contains naming convention | string | yes |
| `location` | default azure region and can be used if location is not specified inside the object | string | no |
| `resource_group` | default resource group and can be used if resourcegroup is not specified inside the object | string | no |
| `tags` | tags to be added to the resources | map(string) | no |
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_location"></a> [location](#input\_location) | default azure region and can be used if location is not specified inside the object. | `string` | `null` | no |
| <a name="input_naming"></a> [naming](#input\_naming) | contains naming convention | `map(string)` | `null` | no |
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | default resource group and can be used if resourcegroup is not specified inside the object. | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | default tags to be used. | `map(string)` | `{}` | no |
| <a name="input_vwan"></a> [vwan](#input\_vwan) | describes virtual wan configuration | `any` | n/a | yes |

## Outputs

| Name | Description |
| :-- | :-- |
| `vwan` | contains virtual wan configuration |
| `vhubs` | contains virtual hub configuration |
|------|-------------|
| <a name="output_vhubs"></a> [vhubs](#output\_vhubs) | contains virtual hub configuration |
| <a name="output_vwan"></a> [vwan](#output\_vwan) | contains virtual wan configuration |
<!-- END_TF_DOCS -->

## Testing

Expand Down
14 changes: 10 additions & 4 deletions modules/routing-intent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,34 @@

This submodule illustrates how to manage routing intents.

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | ~> 3.61 |
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | ~> 4.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 3.61 |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 4.0 |

## Resources

| Name | Type |
|------|------|
| [azurerm_virtual_hub_routing_intent](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_hub_routing_intent) | resource |
| [azurerm_virtual_hub_routing_intent.routing_intent](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_hub_routing_intent) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_configs"></a> [configs](#input\_configs) | the configuration for the routing intents | `any` | n/a | yes |
| <a name="input_configs"></a> [configs](#input\_configs) | the configurations for the routing intents. | `any` | n/a | yes |
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | default resource group and can be used if resourcegroup is not specified inside the object. | `string` | `null` | no |

## Outputs

No outputs.
<!-- END_TF_DOCS -->
File renamed without changes.

0 comments on commit 0011e7d

Please sign in to comment.