Skip to content

Commit e177ecc

Browse files
Add terratest tests (#14)
* Add terratest tests * terraform-docs: automated action * Update deps, small cosmetic changes * Formating --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0f1a6a8 commit e177ecc

File tree

25 files changed

+1558
-146
lines changed

25 files changed

+1558
-146
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ No requirements.
8383
|------|--------|---------|
8484
| <a name="module_cloud_nat"></a> [cloud\_nat](#module\_cloud\_nat) | registry.terraform.io/terraform-google-modules/cloud-nat/google | 4.0.0 |
8585
| <a name="module_network"></a> [network](#module\_network) | registry.terraform.io/terraform-google-modules/network/google | 7.1.0 |
86-
| <a name="module_project"></a> [project](#module\_project) | registry.terraform.io/terraform-google-modules/project-factory/google | 14.2.1 |
87-
| <a name="module_project_services"></a> [project\_services](#module\_project\_services) | terraform-google-modules/project-factory/google//modules/project_services | 14.2.1 |
86+
| <a name="module_project"></a> [project](#module\_project) | registry.terraform.io/terraform-google-modules/project-factory/google | 14.4.0 |
87+
| <a name="module_project_services"></a> [project\_services](#module\_project\_services) | terraform-google-modules/project-factory/google//modules/project_services | 14.4.0 |
8888

8989
## Resources
9090

@@ -113,11 +113,11 @@ No requirements.
113113
| <a name="input_k8s_network_base"></a> [k8s\_network\_base](#input\_k8s\_network\_base) | The IP CIDR base for pods and services secondary networks. Must not overlap with `subnet_network`. Must be a `/16` network. | `string` | n/a | yes |
114114
| <a name="input_master_authorized_networks"></a> [master\_authorized\_networks](#input\_master\_authorized\_networks) | Allows accessing masters only from defined networks. If `enable_private_endpoint` is `true` it must not be any public CIDR block. | `list(map(string))` | <pre>[<br> {<br> "cidr_block": "0.0.0.0/0",<br> "display_name": "ALL"<br> }<br>]</pre> | no |
115115
| <a name="input_master_ipv4_cidr_block"></a> [master\_ipv4\_cidr\_block](#input\_master\_ipv4\_cidr\_block) | The /28 CIDR block for masters when using private cluster. | `string` | `"172.16.0.0/28"` | no |
116-
| <a name="input_node_pools"></a> [node\_pools](#input\_node\_pools) | The object which describes the node pools. The structure is described in the README file. | `map(map(any))` | `{}` | no |
116+
| <a name="input_node_pools"></a> [node\_pools](#input\_node\_pools) | The object which describes the node pools. The structure is described in the README file. | `any` | `{}` | no |
117117
| <a name="input_org_id"></a> [org\_id](#input\_org\_id) | GCP organization id. Required if `create_project` is `true`. | `string` | `""` | no |
118118
| <a name="input_platform_name"></a> [platform\_name](#input\_platform\_name) | The name of the platform. Many resource names are based on this (VPC, subnet, GKE cluster etc). | `string` | n/a | yes |
119-
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Existing project id. Required if `create_project` set to `false` | `string` | `""` | no |
120-
| <a name="input_project_name"></a> [project\_name](#input\_project\_name) | The name of the created project. Defaults to `platform_name` if not set. | `string` | `""` | no |
119+
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Existing project id. Required if `create_project` set to `false` | `string` | `null` | no |
120+
| <a name="input_project_name"></a> [project\_name](#input\_project\_name) | The name of the created project. Defaults to `platform_name` if not set. | `string` | `null` | no |
121121
| <a name="input_region"></a> [region](#input\_region) | Region where to create resources. | `string` | n/a | yes |
122122
| <a name="input_regional"></a> [regional](#input\_regional) | Defines the type of the GKE cluster. If `true` - the cluster is created as `regional`. Otherwise - as `zonal`. | `bool` | `true` | no |
123123
| <a name="input_release_channel"></a> [release\_channel](#input\_release\_channel) | The GKE release channel. | `string` | `"UNSPECIFIED"` | no |

examples/autopilot/main.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module "gke" {
2+
source = "../../"
3+
create_project = true
4+
enable_autopilot = true
5+
billing_account = var.billing_account
6+
org_id = var.org_id
7+
k8s_network_base = "10.100.0.0/16"
8+
platform_name = var.platform_name
9+
region = "europe-central2"
10+
subnet_network = "10.1.0.0/20"
11+
regional = true
12+
node_pools = {}
13+
}

examples/autopilot/outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
output "project_id" {
2+
value = module.gke.project_id
3+
}
4+
output "gke_cluster_id" {
5+
value = module.gke.gke_cluster_id
6+
}

examples/autopilot/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "billing_account" {
2+
type = string
3+
}
4+
variable "org_id" {
5+
type = string
6+
}
7+
variable "platform_name" {
8+
type = string
9+
}

examples/existing-project/main.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module "gke" {
2+
source = "../../"
3+
region = "europe-central2"
4+
create_project = false
5+
project_id = var.project_id
6+
platform_name = var.platform_name
7+
disable_services_on_destroy = false
8+
subnet_network = "10.1.0.0/16"
9+
k8s_network_base = "10.100.0.0/16"
10+
regional = false
11+
zones = ["europe-central2-a"]
12+
node_pools = {
13+
default-pool = {
14+
disk_size_gb = 50
15+
max_count = 3
16+
preemptible = true
17+
},
18+
other-pool = {
19+
disk_size_gb = 100
20+
preemptible = true
21+
}
22+
}
23+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "gke_cluster_id" {
2+
value = module.gke.gke_cluster_id
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
variable "project_id" {
2+
type = string
3+
default = "sml-internal"
4+
}
5+
variable "platform_name" {
6+
type = string
7+
}

examples/terraform/private-cluster-new-project/main.tf renamed to examples/new-project/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module "gke" {
2-
source = "../../../"
2+
source = "../../"
33
create_project = true
4-
billing_account = "<BILLING_ACCOUNT>" // replace with your billing account
5-
org_id = "<ORG_ID>" // replace with your org id
4+
billing_account = var.billing_account
5+
org_id = var.org_id
66
k8s_network_base = "10.100.0.0/16"
7-
platform_name = "test-gke"
7+
platform_name = var.platform_name
88
region = "europe-central2"
99
subnet_network = "10.1.0.0/20"
1010
regional = false

examples/new-project/outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
output "project_id" {
2+
value = module.gke.project_id
3+
}
4+
output "gke_cluster_id" {
5+
value = module.gke.gke_cluster_id
6+
}

examples/new-project/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "billing_account" {
2+
type = string
3+
}
4+
variable "org_id" {
5+
type = string
6+
}
7+
variable "platform_name" {
8+
type = string
9+
}

0 commit comments

Comments
 (0)