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

chore(CI): add repo tflint rules #203

Merged
merged 1 commit into from
Aug 12, 2024
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
75 changes: 75 additions & 0 deletions .github/.tflint.repo.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2022-2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

// disable all rules by default
config {
disabled_by_default = true
}

plugin "terraform" {
enabled = true
}

rule "terraform_deprecated_index" {
enabled = true
}

rule "terraform_deprecated_interpolation" {
enabled = true
}

rule "terraform_empty_list_equality" {
enabled = true
}

rule "terraform_module_pinned_source" {
enabled = true
}

rule "terraform_module_version" {
enabled = true
}

rule "terraform_unused_declarations" {
enabled = true
}

// module specific
rule "terraform_documented_outputs" {
enabled = true
}

rule "terraform_documented_variables" {
enabled = true
}

rule "terraform_module_pinned_source" {
enabled = true
}

rule "terraform_module_version" {
enabled = true
}

rule "terraform_required_providers" {
enabled = true
}

rule "terraform_required_version" {
enabled = true
}

rule "terraform_typed_variables" {
enabled = true
}
2 changes: 1 addition & 1 deletion 3-appfactory/modules/app-group-baseline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| bucket\_force\_destroy | When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects. | `bool` | `false` | no |
| bucket\_prefix | Name prefix to use for buckets created. | `string` | `"bkt"` | no |
| cloudbuild\_sa\_roles | Optional to assign to custom CloudBuild SA. Map of project name or any static key to object with list of roles. Keys much match keys from var.envs | <pre>map(object({<br> roles = list(string)<br> }))</pre> | `{}` | no |
| create\_env\_projects | n/a | `bool` | `true` | no |
| create\_env\_projects | Create environment-specific application infra projects | `bool` | `true` | no |
| env\_project\_apis | List of APIs to enable for environment-specific application infra projects | `list(string)` | <pre>[<br> "iam.googleapis.com",<br> "cloudresourcemanager.googleapis.com",<br> "serviceusage.googleapis.com",<br> "cloudbilling.googleapis.com"<br>]</pre> | no |
| envs | Environments | <pre>map(object({<br> billing_account = string<br> folder_id = string<br> network_project_id = string<br> network_self_link = string<br> org_id = string<br> subnets_self_links = list(string)<br> }))</pre> | n/a | yes |
| folder\_id | Folder ID of parent folder for application admin resources. If deploying on the enterprise foundation blueprint, this is usually the 'common' folder. | `string` | n/a | yes |
Expand Down
5 changes: 3 additions & 2 deletions 3-appfactory/modules/app-group-baseline/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ variable "envs" {
}

variable "create_env_projects" {
type = bool
default = true
type = bool
default = true
description = "Create environment-specific application infra projects"
}

variable "env_project_apis" {
Expand Down
6 changes: 4 additions & 2 deletions 5-appinfra/modules/cicd-pipeline/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ terraform {

required_providers {
google = {
source = "hashicorp/google"
source = "hashicorp/google"
version = ">= 5, < 6"
}
google-beta = {
source = "hashicorp/google-beta"
source = "hashicorp/google-beta"
version = ">= 5, < 6"
}
}

Expand Down
11 changes: 11 additions & 0 deletions 5-appinfra/modules/env_baseline/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
terraform {
required_version = ">= 1.3"

required_providers {
google = {
source = "hashicorp/google"
version = ">= 5, < 6"
}
random = {
source = "hashicorp/random"
version = ">= 3"
}
}

provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-enterprise-application:bootstrap/v0.1.0"
}
Expand Down