Skip to content

Commit 4c1580f

Browse files
malhussanmeshkodiak[bot]
authored andcommitted
feat: add a pre-commit config file
1 parent 91b120c commit 4c1580f

File tree

13 files changed

+130
-68
lines changed

13 files changed

+130
-68
lines changed

.github/workflows/workflow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: Validate
88
runs-on: ubuntu-latest
99
steps:
10-
- name: Check out code
10+
- name: Check out code
1111
uses: actions/checkout@v1
1212

1313
- uses: hashicorp/setup-terraform@v1

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v1.2.3
4+
hooks:
5+
- id: trailing-whitespace
6+
- repo: https://github.com/antonbabenko/pre-commit-terraform
7+
rev: v1.73.0
8+
hooks:
9+
- id: terraform_fmt
10+
- id: terraform_validate
11+
- id: terraform_docs
12+
args:
13+
- --args=--config=.terraform-docs.yml

.terraform-docs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
formatter: "markdown" # this is required
2+
3+
version: ""
4+
5+
recursive:
6+
enabled: false
7+
path: modules
8+
9+
content: ""
10+
11+
output:
12+
file: "README.md"
13+
mode: inject
14+
template: |-
15+
<!-- BEGIN_TF_DOCS -->
16+
{{ .Content }}
17+
<!-- END_TF_DOCS -->
18+
19+
sort:
20+
enabled: true
21+
by: name

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
- Added CHANGELOG.md
13+
- Added pre-commit hooks
14+
15+
## [v0.1.0]
16+
17+
- Initial Release
18+
19+
[unreleased]: https://github.com/meshcloud/terraform-gcp-meshplatform/compare/v0.1.0...HEAD
20+
[v0.1.0]: https://github.com/meshcloud/terraform-gcp-meshplatform/releases/tag/v0.1.0

README.md

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Terraform module to integrate GCP as a meshPlatform into meshStack instance. Wit
1111
To run this module, you need the following:
1212

1313
- Required permissions. The user or service account applying this module needs the following permissions:
14-
14+
1515
Project-level:
1616

1717
```hcl
@@ -59,10 +59,6 @@ To run this module, you need the following:
5959
6060
Additionally, after the module has run, one of the Service Accounts needs to be granted a role in the Admin Console (Workspace). This can only be done by Super Administrators.
6161
62-
## Module Structure
63-
64-
For an overview of the module structure, refer to [generated terraform docs](./TERRAFORM_DOCS.md)
65-
6662
## How to Use This Module
6763
6864
Before using this module, you need a gcp project. We recommend creating a new project for meshcloud service accounts.
@@ -118,3 +114,66 @@ resource "google_project" "meshstack_root" {
118114
## Example Usages
119115

120116
Check [examples](./examples/) for different use cases. As a quick start we recommend using [basic-gcp-integration](./examples/basic-gcp-integration) example.
117+
118+
## Contributing Guide
119+
120+
Before opening a Pull Request, we recommend following the below steps to get a faster approval:
121+
122+
1. Install [pre-commit](https://pre-commit.com/#install)
123+
124+
We use pre-commit to perform several terraform related tasks such as `terraform validate`, `terraform fmt`, and generating terraform docs with `terraform_docs`
125+
126+
2. Execute `pre-commit install`: Hooks configured in `.pre-commit-config.yaml` will be executed automatically on commit. For manual execution, you can use `pre-commit run -a`.
127+
128+
<!-- BEGIN_TF_DOCS -->
129+
## Requirements
130+
131+
| Name | Version |
132+
|------|---------|
133+
| <a name="requirement_google"></a> [google](#requirement\_google) | 4.11.0 |
134+
135+
## Providers
136+
137+
No providers.
138+
139+
## Modules
140+
141+
| Name | Source | Version |
142+
|------|--------|---------|
143+
| <a name="module_carbon_export"></a> [carbon\_export](#module\_carbon\_export) | ./modules/meshcloud-carbon-export/ | n/a |
144+
| <a name="module_kraken_sa"></a> [kraken\_sa](#module\_kraken\_sa) | ./modules/meshcloud-kraken-service-account/ | n/a |
145+
| <a name="module_replicator_sa"></a> [replicator\_sa](#module\_replicator\_sa) | ./modules/meshcloud-replicator-service-account/ | n/a |
146+
147+
## Resources
148+
149+
No resources.
150+
151+
## Inputs
152+
153+
| Name | Description | Type | Default | Required |
154+
|------|-------------|------|---------|:--------:|
155+
| <a name="input_billing_account_id"></a> [billing\_account\_id](#input\_billing\_account\_id) | The GCP billing account in your organization. | `string` | n/a | yes |
156+
| <a name="input_billing_org_id"></a> [billing\_org\_id](#input\_billing\_org\_id) | GCP organization ID that holds billing account. | `string` | n/a | yes |
157+
| <a name="input_carbon_export_module_enabled"></a> [carbon\_export\_module\_enabled](#input\_carbon\_export\_module\_enabled) | Determines whether or not to include the resources of the carbon footprint export module. | `bool` | `false` | no |
158+
| <a name="input_carbon_footprint_dataset_id"></a> [carbon\_footprint\_dataset\_id](#input\_carbon\_footprint\_dataset\_id) | Id of BigQuery dataset for carbon footprint. | `string` | `"carbon_footprint_data"` | no |
159+
| <a name="input_carbon_footprint_dataset_location"></a> [carbon\_footprint\_dataset\_location](#input\_carbon\_footprint\_dataset\_location) | Location of BigQuery dataset for carbon footprint. | `string` | `"us-west1"` | no |
160+
| <a name="input_cloud_billing_export_dataset_id"></a> [cloud\_billing\_export\_dataset\_id](#input\_cloud\_billing\_export\_dataset\_id) | GCP BigQuery dataset containing the Cloud Billing BigQuery export. This variable is only required to form the output for meshPlatform configuration. No resources are created or attached. | `string` | n/a | yes |
161+
| <a name="input_cloud_billing_export_project_id"></a> [cloud\_billing\_export\_project\_id](#input\_cloud\_billing\_export\_project\_id) | GCP Project where the BiqQuery table resides that holds the Cloud Billing export to BigQuery. See https://cloud.google.com/billing/docs/how-to/export-data-bigquery | `string` | n/a | yes |
162+
| <a name="input_cloud_billing_export_table_id"></a> [cloud\_billing\_export\_table\_id](#input\_cloud\_billing\_export\_table\_id) | GCP BigQuery table containing the Cloud Billing BigQuery export. This variable is only required to form the output for meshPlatform configuration. No resources are created or attached. | `string` | n/a | yes |
163+
| <a name="input_kraken_sa_name"></a> [kraken\_sa\_name](#input\_kraken\_sa\_name) | Name of the service account to create for Kraken. | `string` | `"mesh-kraken-service-tf"` | no |
164+
| <a name="input_landing_zone_folder_ids"></a> [landing\_zone\_folder\_ids](#input\_landing\_zone\_folder\_ids) | GCP Folders that make up the Landing Zone. The service account will only receive permissions on these folders. | `list(string)` | n/a | yes |
165+
| <a name="input_org_id"></a> [org\_id](#input\_org\_id) | GCP Organization ID that holds the projects that generate billing data that the service account should import. | `string` | n/a | yes |
166+
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | GCP Project ID where to create the resources. This is typically a 'meshstack-root' project. | `string` | n/a | yes |
167+
| <a name="input_replicator_sa_name"></a> [replicator\_sa\_name](#input\_replicator\_sa\_name) | Name of the service account to create for Replicator. | `string` | `"mesh-replicator-service-tf"` | no |
168+
169+
## Outputs
170+
171+
| Name | Description |
172+
|------|-------------|
173+
| <a name="output_cloud_billing_export_table_name"></a> [cloud\_billing\_export\_table\_name](#output\_cloud\_billing\_export\_table\_name) | The BigQuery table name containing the GCP Cloud Billing BigQuery export. |
174+
| <a name="output_kraken_sa_email"></a> [kraken\_sa\_email](#output\_kraken\_sa\_email) | Kraken service account email. |
175+
| <a name="output_kraken_sa_key"></a> [kraken\_sa\_key](#output\_kraken\_sa\_key) | Kraken service account key. |
176+
| <a name="output_replicator_manual_setup"></a> [replicator\_manual\_setup](#output\_replicator\_manual\_setup) | Replicator service account setup information. |
177+
| <a name="output_replicator_sa_email"></a> [replicator\_sa\_email](#output\_replicator\_sa\_email) | Replicator service account email. |
178+
| <a name="output_replicator_sa_key"></a> [replicator\_sa\_key](#output\_replicator\_sa\_key) | Replicator service account key (base64 encoded credential.json). |
179+
<!-- END_TF_DOCS -->

TERRAFORM_DOCS.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

generate_tf_docs.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

modules/meshcloud-carbon-export/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- BEGIN_TF_DOCS -->
12
## Requirements
23

34
| Name | Version |
@@ -37,3 +38,4 @@ No modules.
3738
| Name | Description |
3839
|------|-------------|
3940
| <a name="output_carbon_footprint_export_table_name"></a> [carbon\_footprint\_export\_table\_name](#output\_carbon\_footprint\_export\_table\_name) | The BigQuery table name containing the GCP Carbon Footprint BigQuery export. |
41+
<!-- END_TF_DOCS -->

modules/meshcloud-kraken-service-account/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- BEGIN_TF_DOCS -->
12
## Requirements
23

34
| Name | Version |
@@ -42,3 +43,4 @@ No modules.
4243
|------|-------------|
4344
| <a name="output_sa_email"></a> [sa\_email](#output\_sa\_email) | Service account email. |
4445
| <a name="output_sa_key"></a> [sa\_key](#output\_sa\_key) | Service account key (base64 encoded credential.json). |
46+
<!-- END_TF_DOCS -->

modules/meshcloud-replicator-lz-access-cloudfunction/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- BEGIN_TF_DOCS -->
12
## Requirements
23

34
| Name | Version |
@@ -32,3 +33,4 @@ No modules.
3233
## Outputs
3334

3435
No outputs.
36+
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)