diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 10e4b83..d4e5436 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,6 +11,15 @@ repos: - id: check-symlinks - id: no-commit-to-branch + - repo: local + hooks: + - id: infracost_generate_config + name: Infracost generate config + entry: bash -c 'infracost generate config --repo-path=. --template-path=infracost.yml.tmpl --out-file=infracost.yml' + language: system + files: ^infracost\.yml\.tmpl$ + verbose: false + - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.83.6 hooks: @@ -33,3 +42,4 @@ repos: args: - --args=--config-file=infracost.yml - --args=--sync-usage-file + verbose: false diff --git a/README.md b/README.md index d10089d..36f55c3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Monthly cost estimates for this module based on these usage values: -- [default cloud sql](test/fixtures/default_cloud_sql/infracost.yml) +- [default cloud sql](test/fixtures/default_cloud_sql/infracost-usage.yml) ## Repository Description diff --git a/infracost.yml b/infracost.yml index ed48ed8..5fbfdde 100644 --- a/infracost.yml +++ b/infracost.yml @@ -8,4 +8,4 @@ version: 0.1 projects: - path: test/fixtures/default_cloud_sql name: "default_cloud_sql" - usage_file: test/fixtures/default_cloud_sql/infracost.yml + usage_file: test/fixtures/default_cloud_sql/infracost-usage.yml diff --git a/infracost.yml.tmpl b/infracost.yml.tmpl index 38f9ffd..d8d3b79 100644 --- a/infracost.yml.tmpl +++ b/infracost.yml.tmpl @@ -11,6 +11,6 @@ projects: {{- if ne $project.name "shared"}} - path: {{ print $project._dir "/" $project.name }} name: "{{ $project.name }}" - usage_file: {{ print $project._dir "/" $project.name "/infracost.yml" }} + usage_file: {{ print $project._dir "/" $project.name "/infracost-usage.yml" }} {{- end }} {{- end}} diff --git a/regional/README.md b/regional/README.md index 66204f5..cbeebac 100644 --- a/regional/README.md +++ b/regional/README.md @@ -33,13 +33,13 @@ No modules. | [availability\_type](#input\_availability\_type) | The availability type of the Cloud SQL instance | `string` | `"REGIONAL"` | no | | [backup\_start\_time](#input\_backup\_start\_time) | Time indicating when backup configuration starts | `string` | `"04:00"` | no | | [client\_certs](#input\_client\_certs) | A set of client cert names, note: 10 max per instance | `set(string)` | `[]` | no | -| [cost\_center](#input\_cost\_center) | The cost center to label the project with | `string` | n/a | yes | +| [cost\_center](#input\_cost\_center) | The cost center to use for resource labels | `string` | n/a | yes | | [database\_flags](#input\_database\_flags) | The database flags for Cloud SQL. See [PostgreSQL Flags](https://cloud.google.com/sql/docs/postgres/flags) |
list(object({
name = string
value = string
}))
| `[]` | no | | [database\_version](#input\_database\_version) | The MySQL, PostgreSQL or SQL Server version to use. | `string` | `"POSTGRES_15"` | no | | [deletion\_protection](#input\_deletion\_protection) | Whether or not to allow Terraform to destroy the instance | `bool` | `true` | no | | [host\_project\_id](#input\_host\_project\_id) | Host project ID for the shared VPC | `string` | `""` | no | | [instance\_name](#input\_instance\_name) | The name of the instance | `string` | n/a | yes | -| [labels](#input\_labels) | A set of key/value label pairs to assign to the project | `map(string)` | `{}` | no | +| [labels](#input\_labels) | A map of key/value pairs to assign to the resources being created | `map(string)` | `{}` | no | | [machine\_tier](#input\_machine\_tier) | The machine type to use. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312 | `string` | `"db-f1-micro"` | no | | [mw\_day](#input\_mw\_day) | Maintenance window day | `number` | `4` | no | | [mw\_hour](#input\_mw\_hour) | Maintenance window hour | `number` | `17` | no | diff --git a/regional/variables.tf b/regional/variables.tf index cd110d8..198a504 100644 --- a/regional/variables.tf +++ b/regional/variables.tf @@ -17,7 +17,7 @@ variable "client_certs" { } variable "cost_center" { - description = "The cost center to label the project with" + description = "The cost center to use for resource labels" type = string } @@ -54,7 +54,7 @@ variable "instance_name" { } variable "labels" { - description = "A set of key/value label pairs to assign to the project" + description = "A map of key/value pairs to assign to the resources being created" type = map(string) default = {} } diff --git a/test/fixtures/default_cloud_sql/infracost.yml b/test/fixtures/default_cloud_sql/infracost-usage.yml similarity index 100% rename from test/fixtures/default_cloud_sql/infracost.yml rename to test/fixtures/default_cloud_sql/infracost-usage.yml