-
Notifications
You must be signed in to change notification settings - Fork 347
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
Add support for Terraform 0.12 #52
Conversation
Signed-off-by: Minh-Quan TRAN <account@itscaro.me>
- 'examples/basic' migrated and provisioned ``` $ terraform apply -auto-approve module.mig1_template.data.google_compute_image.image_family: Refreshing state... module.mig2.data.google_compute_zones.available: Refreshing state... module.mig2_template.data.google_compute_image.image_family: Refreshing state... module.mig1.data.google_compute_zones.available: Refreshing state... module.mig2_template.data.google_compute_image.image: Refreshing state... module.mig1_template.data.google_compute_image.image: Refreshing state... data.template_file.group-startup-script: Refreshing state... google_compute_network.default: Creating... module.gce-lb-http.google_compute_http_health_check.default[0]: Creating... module.gce-lb-http.google_compute_global_address.default: Creating... module.gce-lb-http.google_compute_http_health_check.default[0]: Creation complete after 4s [id=mig-basic-lb-backend-0] module.gce-lb-http.google_compute_global_address.default: Creation complete after 4s [id=mig-basic-lb-address] google_compute_network.default: Still creating... [10s elapsed] google_compute_network.default: Still creating... [20s elapsed] google_compute_network.default: Creation complete after 28s [id=mig-basic] google_compute_subnetwork.group1: Creating... google_compute_subnetwork.group2: Creating... google_compute_subnetwork.group1: Still creating... [10s elapsed] google_compute_subnetwork.group2: Still creating... [10s elapsed] google_compute_subnetwork.group2: Creation complete after 17s [id=us-east1/mig-basic-group2] module.mig2_template.google_compute_instance_template.tpl: Creating... google_compute_subnetwork.group1: Still creating... [20s elapsed] module.mig2_template.google_compute_instance_template.tpl: Creation complete after 5s [id=mig-basic-group2-20190822225210380000000001] module.mig2.google_compute_region_instance_group_manager.mig: Creating... google_compute_subnetwork.group1: Creation complete after 28s [id=us-west1/mig-basic-group1] google_compute_subnetwork.lb: Creating... module.mig1_template.google_compute_instance_template.tpl: Creating... module.mig2.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed] module.mig1_template.google_compute_instance_template.tpl: Creation complete after 5s [id=mig-basic-group1-20190822225221497600000002] module.gce-lb-http.google_compute_firewall.default-hc[0]: Creating... module.mig1.google_compute_region_instance_group_manager.mig: Creating... google_compute_subnetwork.lb: Still creating... [10s elapsed] module.gce-lb-http.google_compute_firewall.default-hc[0]: Creation complete after 8s [id=mig-basic-lb-hc-0] module.mig2.google_compute_region_instance_group_manager.mig: Still creating... [20s elapsed] module.mig1.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed] google_compute_subnetwork.lb: Still creating... [20s elapsed] module.mig1.google_compute_region_instance_group_manager.mig: Creation complete after 18s [id=gl-ivankorniienko-seed/us-west1/mig-basic-group1-mig] module.mig2.google_compute_region_instance_group_manager.mig: Creation complete after 29s [id=gl-ivankorniienko-seed/us-east1/mig-basic-group2-mig] module.gce-lb-http.google_compute_backend_service.default[0]: Creating... google_compute_subnetwork.lb: Creation complete after 29s [id=us-west1/mig-basic-lb] module.gce-lb-http.google_compute_backend_service.default[0]: Creation complete after 9s [id=mig-basic-lb-backend-0] module.gce-lb-http.google_compute_url_map.default[0]: Creating... module.gce-lb-http.google_compute_url_map.default[0]: Creation complete after 4s [id=mig-basic-lb-url-map] module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creating... module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creation complete after 4s [id=mig-basic-lb-http-proxy] module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creating... module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Still creating... [10s elapsed] module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creation complete after 18s [id=mig-basic-lb] Apply complete! Resources: 15 added, 0 changed, 0 destroyed. Outputs: load-balancer-ip = 35.244.166.214 ```
….12 syntax, interpolation, dynamic blocks, etc): - examples/basic -> examples/multi-mig-http-lb - examples/http-nat-gateway -> examples/mig-nat-http-lb - examples/https-content -> examples/multi-backend-multi-mig-bucket-https-lb - examples/multiple-certs (similar to above, but with multiple certs) ref: terraform-google-modules#51
- migrated the example code to 0.12 syntax and 0.12 compatible modules - slightly modified core module logic to handle shared vpc specific case as well - switched to using common symlink for startup script template - added provisioning for shared network, subnetwork, router and cloud nat Please note: Due to bug/limitation of instance_template sumbodule(reported here terraform-google-modules/terraform-google-vm#29), the shared vpc example is currently broken and fails on creating an instance template with shared network: ``` $ terraform apply -auto-approve module.cloud-nat.random_string.name_suffix: Refreshing state... [id=t24x9w] data.template_file.group-startup-script: Refreshing state... module.gce-lb-http.google_compute_firewall.default-hc[0]: Refreshing state... [id=group-http-lb-hc-0] module.gce-lb-http.google_compute_http_health_check.default[0]: Refreshing state... [id=group-http-lb-backend-0] module.gce-lb-http.google_compute_global_address.default: Refreshing state... [id=group-http-lb-address] google_compute_network.default: Refreshing state... [id=shared-vpc-lb-http] module.mig.data.google_compute_zones.available: Refreshing state... module.mig_template.data.google_compute_image.image_family: Refreshing state... module.mig_template.data.google_compute_image.image: Refreshing state... google_compute_router.default: Refreshing state... [id=us-central1/lb-http-router] google_compute_subnetwork.default: Refreshing state... [id=us-central1/shared-vpc-lb-http] module.cloud-nat.google_compute_router_nat.main: Refreshing state... [id=us-central1/lb-http-router/cloud-nat-lb-http-router] module.mig_template.google_compute_instance_template.tpl: Creating... Error: Error creating instance template: googleapi: Error 400: Invalid value for field 'resource.properties.networkInterfaces[0].subnetwork': 'projects/gl-ik-shared/regions/us-central1/subnetworks/shared-vpc-lb-http'. Cross-project references for this resource are not allowed., invalid on .terraform/modules/mig_template/terraform-google-modules-terraform-google-vm-cb3d6cc/modules/instance_template/main.tf line 51, in resource "google_compute_instance_template" "tpl": 51: resource "google_compute_instance_template" "tpl" { ```
ref: terraform-google-modules#51 ``` [18:54][user@host:~/workspace/google/terraform-google-lb-http/examples/mig-nat-http-lb]$ terraform apply -auto-approve module.mig.data.google_compute_zones.available: Refreshing state... module.mig_template.data.google_compute_image.image: Refreshing state... module.mig_template.data.google_compute_image.image_family: Refreshing state... data.template_file.group-startup-script: Refreshing state... module.cloud-nat.random_string.name_suffix: Creating... module.cloud-nat.random_string.name_suffix: Creation complete after 0s [id=jb4pjk] google_compute_network.default: Creating... module.gce-lb-http.google_compute_global_address.default: Creating... module.gce-lb-http.google_compute_health_check.default[0]: Creating... module.gce-lb-http.google_compute_health_check.default[0]: Creation complete after 5s [id=mig-http-lb-http-80-6666cd76] module.gce-lb-http.google_compute_global_address.default: Creation complete after 5s [id=mig-http-lb-address] google_compute_network.default: Still creating... [10s elapsed] google_compute_network.default: Still creating... [20s elapsed] google_compute_network.default: Creation complete after 28s [id=tf-lb-http-mig-nat] google_compute_router.default: Creating... google_compute_subnetwork.default: Creating... module.gce-lb-http.google_compute_firewall.default["tf-lb-http-mig-nat"]: Creating... google_compute_router.default: Creation complete after 5s [id=us-west1/lb-http-router] module.cloud-nat.google_compute_router_nat.main: Creating... google_compute_subnetwork.default: Still creating... [10s elapsed] module.gce-lb-http.google_compute_firewall.default["tf-lb-http-mig-nat"]: Still creating... [10s elapsed] module.cloud-nat.google_compute_router_nat.main: Still creating... [10s elapsed] google_compute_subnetwork.default: Still creating... [20s elapsed] module.gce-lb-http.google_compute_firewall.default["tf-lb-http-mig-nat"]: Still creating... [20s elapsed] module.cloud-nat.google_compute_router_nat.main: Creation complete after 17s [id=us-west1/lb-http-router/cloud-nat-lb-http-router] module.gce-lb-http.google_compute_firewall.default["tf-lb-http-mig-nat"]: Creation complete after 28s [id=mig-http-lb-tf-lb-http-mig-nat-hc] google_compute_subnetwork.default: Still creating... [30s elapsed] google_compute_subnetwork.default: Creation complete after 39s [id=us-west1/tf-lb-http-mig-nat] module.mig_template.google_compute_instance_template.tpl: Creating... module.mig_template.google_compute_instance_template.tpl: Creation complete after 4s [id=tf-lb-http-mig-nat-20190906155713028900000001] module.mig.google_compute_region_instance_group_manager.mig: Creating... module.mig.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed] module.mig.google_compute_region_instance_group_manager.mig: Still creating... [20s elapsed] module.mig.google_compute_region_instance_group_manager.mig: Creation complete after 29s [id=gl-ivankorniienko-seed-251912/us-west1/tf-lb-http-mig-nat-mig] module.gce-lb-http.google_compute_backend_service.default["0"]: Creating... module.gce-lb-http.google_compute_backend_service.default["0"]: Creation complete after 9s [id=mig-http-lb-backend-0] module.gce-lb-http.google_compute_url_map.default[0]: Creating... module.gce-lb-http.google_compute_url_map.default[0]: Creation complete after 4s [id=mig-http-lb-url-map] module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creating... module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creation complete after 4s [id=mig-http-lb-http-proxy] module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creating... module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creation complete after 10s [id=mig-http-lb] Apply complete! Resources: 14 added, 0 changed, 0 destroyed. Outputs: load-balancer-ip = 35.190.121.34 [18:58][user@host:~/workspace/google/terraform-google-lb-http/examples/mig-nat-http-lb]$ less plat.output.txt [19:05][user@host:~/workspace/google/terraform-google-lb-http/examples/mig-nat-http-lb]$ ./test.sh + set -e ++ terraform output load-balancer-ip + URL=http://35.190.121.34 + status=0 + count=0 + [[ 0 -lt 720 ]] + [[ 0 -ne 200 ]] + echo 'INFO: Waiting for load balancer...' INFO: Waiting for load balancer... ++ curl -sf -m 5 -o /dev/null -w '%{http_code}' http://35.190.121.34 + status=200 + (( count=count+1 )) + sleep 5 + [[ 1 -lt 720 ]] + [[ 200 -ne 200 ]] + [[ 1 -lt 720 ]] + echo 'INFO: PASS' INFO: PASS ``` ``` [18:54][user@host:~/workspace/google/terraform-google-lb-http/examples/multi-mig-http-lb]$ terraform apply -auto-approve module.mig2.data.google_compute_zones.available: Refreshing state... module.mig2_template.data.google_compute_image.image_family: Refreshing state... module.mig1_template.data.google_compute_image.image_family: Refreshing state... module.mig2_template.data.google_compute_image.image: Refreshing state... module.mig1_template.data.google_compute_image.image: Refreshing state... module.mig1.data.google_compute_zones.available: Refreshing state... data.template_file.group-startup-script: Refreshing state... module.cloud-nat-group1.random_string.name_suffix: Creating... module.cloud-nat-group2.random_string.name_suffix: Creating... module.cloud-nat-group1.random_string.name_suffix: Creation complete after 0s [id=mds1om] module.cloud-nat-group2.random_string.name_suffix: Creation complete after 0s [id=971f2q] google_compute_network.default: Creating... module.gce-lb-http.google_compute_global_address.default: Creating... module.gce-lb-http.google_compute_health_check.default[0]: Creating... module.gce-lb-http.google_compute_global_address.default: Creation complete after 5s [id=multi-mig-lb-http-address] module.gce-lb-http.google_compute_health_check.default[0]: Creation complete after 5s [id=multi-mig-lb-http-http-80-6666cd76] google_compute_network.default: Still creating... [10s elapsed] google_compute_network.default: Creation complete after 17s [id=multi-mig-lb-http] google_compute_router.group1: Creating... google_compute_subnetwork.group2: Creating... google_compute_subnetwork.group1: Creating... google_compute_router.group2: Creating... google_compute_router.group2: Creation complete after 4s [id=us-east1/multi-mig-lb-http-gw-group2] module.cloud-nat-group2.google_compute_router_nat.main: Creating... google_compute_router.group1: Creation complete after 4s [id=us-west1/multi-mig-lb-http-gw-group1] module.cloud-nat-group1.google_compute_router_nat.main: Creating... module.gce-lb-http.google_compute_firewall.default["multi-mig-lb-http"]: Creating... google_compute_subnetwork.group2: Still creating... [10s elapsed] google_compute_subnetwork.group1: Still creating... [10s elapsed] module.cloud-nat-group2.google_compute_router_nat.main: Still creating... [10s elapsed] module.cloud-nat-group1.google_compute_router_nat.main: Still creating... [10s elapsed] module.gce-lb-http.google_compute_firewall.default["multi-mig-lb-http"]: Still creating... [10s elapsed] google_compute_subnetwork.group2: Still creating... [20s elapsed] google_compute_subnetwork.group1: Still creating... [20s elapsed] module.gce-lb-http.google_compute_firewall.default["multi-mig-lb-http"]: Creation complete after 17s [id=multi-mig-lb-http-multi-mig-lb-http-hc] module.cloud-nat-group2.google_compute_router_nat.main: Creation complete after 17s [id=us-east1/multi-mig-lb-http-gw-group2/multi-mig-lb-http-cloud-nat-group2] module.cloud-nat-group1.google_compute_router_nat.main: Creation complete after 18s [id=us-west1/multi-mig-lb-http-gw-group1/multi-mig-lb-http-cloud-nat-group1] google_compute_subnetwork.group2: Creation complete after 27s [id=us-east1/multi-mig-lb-http-group2] module.mig2_template.google_compute_instance_template.tpl: Creating... google_compute_subnetwork.group1: Creation complete after 27s [id=us-west1/multi-mig-lb-http-group1] module.mig1_template.google_compute_instance_template.tpl: Creating... module.mig2_template.google_compute_instance_template.tpl: Creation complete after 4s [id=multi-mig-lb-http-group2-20190906155604990200000001] module.mig2.google_compute_region_instance_group_manager.mig: Creating... module.mig1_template.google_compute_instance_template.tpl: Creation complete after 5s [id=multi-mig-lb-http-group1-20190906155605140900000002] module.mig1.google_compute_region_instance_group_manager.mig: Creating... module.mig2.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed] module.mig1.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed] module.mig2.google_compute_region_instance_group_manager.mig: Creation complete after 19s [id=gl-ivankorniienko-seed-251912/us-east1/multi-mig-lb-http-group2-mig] module.mig1.google_compute_region_instance_group_manager.mig: Creation complete after 19s [id=gl-ivankorniienko-seed-251912/us-west1/multi-mig-lb-http-group1-mig] module.gce-lb-http.google_compute_backend_service.default["0"]: Creating... module.gce-lb-http.google_compute_backend_service.default["0"]: Still creating... [10s elapsed] module.gce-lb-http.google_compute_backend_service.default["0"]: Creation complete after 17s [id=multi-mig-lb-http-backend-0] module.gce-lb-http.google_compute_url_map.default[0]: Creating... module.gce-lb-http.google_compute_url_map.default[0]: Creation complete after 4s [id=multi-mig-lb-http-url-map] module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creating... module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creation complete after 4s [id=multi-mig-lb-http-http-proxy] module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creating... module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creation complete after 9s [id=multi-mig-lb-http] Apply complete! Resources: 20 added, 0 changed, 0 destroyed. Outputs: load-balancer-ip = 35.190.47.152 [18:57][user@host:~/workspace/google/terraform-google-lb-http/examples/multi-mig-http-lb]$ ./test.sh + set -e ++ terraform output load-balancer-ip + URL=http://35.190.47.152 + status=0 + count=0 + [[ 0 -lt 720 ]] + [[ 0 -ne 200 ]] + echo 'INFO: Waiting for load balancer...' INFO: Waiting for load balancer... ++ curl -sf -m 5 -o /dev/null -w '%{http_code}' http://35.190.47.152 + status=200 + (( count=count+1 )) + sleep 5 + [[ 1 -lt 720 ]] + [[ 200 -ne 200 ]] + [[ 1 -lt 720 ]] + echo 'INFO: PASS' INFO: PASS [19:14][user@host:~/workspace/google/terraform-google-lb-http/examples/multi-mig-http-lb]$ ```
After migration from
Which seem to be caused by TF issue cc: @morgante @aaron-lane @nick4fake @paulpalamarchuk @kopachevsky @ingwarr |
…alth check" This reverts commit 26efad9.
- Restricted variables value types - Adjusted expression for determining firwall project. Previous version worked for TF 0.12.7, while this works on both 0.12.7 and 0.12.8 Example of funny behaviour: ``` > var.firewall_projects [ "default", ] > var.firewall_projects == ["default"] false > ["default"] == ["default"] true > var.firewall_projects == ["default"] false > var.firewall_projects[0] default > var.firewall_projects == ["default"] false > var.firewall_projects[0] == ["default"][0] true > length(var.firewall_projects) == length(["default"]) true > ``` - Adjusted backend_service output with a for loop as eventually `default.*.self_link` fails with list of maps. 4 examples passing: - mig-nat-http-lb - multiple-certs - multi-mig-http-lb - mig-nat-http-lb Shared VPC still blocked by module vm bug. gke migration to be finalized.
Please, note: the `named_port` module is not migrated to 0.12: "github.com/danisla/terraform-google-named-ports". Test Passed: ``` [23:29][user@host:~/workspace/google/terraform-google-lb-http/examples/https-gke]$ terraform apply -auto-approve data.google_client_config.current: Refreshing state... tls_private_key.example: Creating... random_id.assets-bucket: Creating... random_id.assets-bucket: Creation complete after 0s [id=Gbw] google_storage_bucket.assets: Creating... module.gce-lb-https.google_compute_global_address.default: Creating... module.gce-lb-https.google_compute_http_health_check.default[0]: Creating... module.gce-lb-https.google_compute_firewall.default-hc[0]: Creating... tls_private_key.example: Creation complete after 0s [id=76d79f128ff4de6bfbc481304835e7d55539e3ae] tls_self_signed_cert.example: Creating... tls_self_signed_cert.example: Creation complete after 0s [id=15848693639361799899384461993161024875] module.gce-lb-https.google_compute_ssl_certificate.default[0]: Creating... google_storage_bucket.assets: Creation complete after 2s [id=gl-ivankorniienko-seed-251912-lb-assets-19bc] google_compute_backend_bucket.assets: Creating... google_storage_bucket_object.image: Creating... google_storage_bucket_object.image: Creation complete after 1s [id=gl-ivankorniienko-seed-251912-lb-assets-19bc-assets/gcp-logo.svg] google_storage_object_acl.image-acl: Creating... google_storage_object_acl.image-acl: Creation complete after 1s [id=assets/gcp-logo.svg-acl] module.gce-lb-https.google_compute_http_health_check.default[0]: Creation complete after 5s [id=tf-lb-https-gke-backend-0] module.gce-lb-https.google_compute_backend_service.default[0]: Creating... module.gce-lb-https.google_compute_global_address.default: Creation complete after 5s [id=tf-lb-https-gke-address] module.gce-lb-https.google_compute_ssl_certificate.default[0]: Creation complete after 5s [id=tf-lb-https-gke-certificate-20190911203351172300000001] google_compute_backend_bucket.assets: Creation complete after 4s [id=gl-ivankorniienko-seed-251912-lb-assets-19bc] module.gce-lb-https.google_compute_firewall.default-hc[0]: Still creating... [10s elapsed] module.gce-lb-https.google_compute_backend_service.default[0]: Creation complete after 8s [id=tf-lb-https-gke-backend-0] google_compute_url_map.my-url-map: Creating... google_compute_url_map.my-url-map: Creation complete after 4s [id=tf-lb-https-gke] module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creating... module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creating... module.gce-lb-https.google_compute_firewall.default-hc[0]: Creation complete after 17s [id=tf-lb-https-gke-hc-0] module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creation complete after 5s [id=tf-lb-https-gke-http-proxy] module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creating... module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creation complete after 5s [id=tf-lb-https-gke-https-proxy] module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creating... module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Still creating... [10s elapsed] module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Still creating... [10s elapsed] module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creation complete after 17s [id=tf-lb-https-gke] module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creation complete after 18s [id=tf-lb-https-gke-https] Apply complete! Resources: 17 added, 0 changed, 0 destroyed. Outputs: load-balancer-ip = 35.190.47.152 [23:34][user@host:~/workspace/google/terraform-google-lb-http/examples/https-gke]$ ./test.sh + set -e ++ terraform output load-balancer-ip + URL=https://35.190.47.152 + status=0 + count=0 + [[ 0 -lt 720 ]] + [[ 0 -ne 200 ]] + echo 'INFO: Waiting for load balancer...' INFO: Waiting for load balancer... ++ curl -sfk -m 5 -o /dev/null -w '%{http_code}' https://35.190.47.152 + status=200 + (( count=count+1 )) + sleep 5 + [[ 1 -lt 720 ]] + [[ 200 -ne 200 ]] + [[ 1 -lt 720 ]] + echo 'INFO: PASS. Load balancer is ready.' INFO: PASS. Load balancer is ready. [00:29][user@host:~/workspace/google/terraform-google-lb-http/examples/https-gke]$ ```
Seems to be branch not rebased, 3rdparty commits in PR |
Example tests (all but shared-vpc are passing):
|
@kopachevsky, this is continuation of the work started by those commits, as requested |
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as [requested](terraform-google-modules#52 (comment))
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as [requested](terraform-google-modules#52 (comment))
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as [requested](terraform-google-modules#52 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as [requested](terraform-google-modules#52 (comment))
variables.tf
Outdated
description = "Map backend indices to list of backend maps." | ||
type = "map" | ||
type = map(list(object({ | ||
group = sting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still missing the other keys which are referenced in google_compute_backend_service.default
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-lane, did you want to make them required? Otherwise we should probably leave previous version with map of strings or only group
key defined
The full validation doesn't work:
The validation with only group
required does:
The rest of attributes are not listed as required or listed under specific conditions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use an object with all supported keys. There is a improvement in the works to support optional object keys with default values, but any undesired key can be passed a value of null
at present. Using a map is misleading because it implies that any key could be valid which is not true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-lane but what if they're not undesired? Dynamic block supports all possible values. If we null them in variables users will have to guess that a var needs to be enabled in the variables file.
Should we document that in readme and/or leave a comment with guidance in the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-lane the null
doesn't work as of now (terraform 0.12.9)
If we we make them required with string type that would brake all the current examples:
as the issue I described here with full validation is still valid.
How do you feel about creating separated issue which would take the awaited terraform feature as a dependency ?
main.tf
Outdated
} | ||
|
||
# Create firewall rule for each backend in each network specified, uses mod behavior of element(). | ||
resource "google_compute_firewall" "default-hc" { | ||
count = "${length(var.firewall_networks) * length(var.backend_params)}" | ||
project = "${element(var.firewall_projects, count.index) == "default" ? var.project : element(var.firewall_projects, count.index)}" | ||
count = length(var.firewall_networks) == 1 ? length(var.firewall_networks) * length(distinct(var.backend_params)) : length(var.firewall_networks) * length(var.backend_params) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as [requested](terraform-google-modules#52 (comment)) - Simplified firewall rules logic as [requested](terraform-google-modules#52 (comment))
@aaron-lane regarding #52 (diff) I can't find my previous comment to this for some reasons, maybe I didn't publish it. The fixed now and current logic is following: we need to create only 1 firewall resource per network and we create a number of dynamic allow rules iterating over distinct set of backend parameters. Can't really find the conversation, but it should be resolved now. Least complex example works:
Most complex example works as well:
|
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as [requested](terraform-google-modules#52 (comment)) - Simplified firewall rules logic as [requested](terraform-google-modules#52 (comment)) - Ajusted provider configuration as [requested](terraform-google-modules#52 (comment))
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as discussed terraform-google-modules#52 (comment) - Simplified firewall rules logic as discussed terraform-google-modules#52 (comment) - Adjusted provider configuration as discussed terraform-google-modules#52 (comment) - Replaced not migrated module call with local_exec in null_resource as discussed terraform-google-modules#52 (comment) - Re-formatted main module output as discussed terraform-google-modules#52 (comment) - Re-named https-gke example input variable as discussed terraform-google-modules#52 (comment)
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as discussed terraform-google-modules#52 (comment) - Simplified firewall rules logic as discussed terraform-google-modules#52 (comment) - Adjusted provider configuration as discussed terraform-google-modules#52 (comment) - Replaced not migrated module call with local_exec in null_resource as discussed terraform-google-modules#52 (comment) - Re-formatted main module output as discussed terraform-google-modules#52 (comment) - Re-named https-gke example input variable as discussed terraform-google-modules#52 (comment)
variables.tf
Outdated
description = "Map backend indices to list of backend maps." | ||
type = "map" | ||
type = map(list(object({ | ||
group = string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add all of the supported keys here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-lane this would brake all the examples down, should we modify them ? How do you feel about my suggestion in the other conversation for the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me clarify this request. The internal object should include each key which is retrieved in the configuration, and each key should be typed correctly. Only specifying group
in this signature is not valid because any other key in an object passed to this variable will be ignored.
balancing_mode = string
capacity_scaler = string
description = string
group = string
max_connections = number
max_connections_per_instance = number
max_rate = number
max_rate_per_instance = number
max_utilization = number
Calling configurations can provide objects with some values to null
if they only need to configure some keys. Additionally, the code in main.tf
which uses this object will not need to provide null
values because that will be handled by the calling configuration.
Examples should be updated to adhere to the new object signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaron-lane, thank you for clarification!
Enforced backend params validation, removed default null
from main, adjusted examples. Fixed
Please, approve if it works!
Retested examples: [passed]
mig-nat-http-lb
[16:05][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/mig-nat-http-lb]$ terraform apply -auto-approve
data.template_file.group-startup-script: Refreshing state...
module.mig.data.google_compute_zones.available: Refreshing state...
module.mig_template.data.google_compute_image.image: Refreshing state...
module.mig_template.data.google_compute_image.image_family: Refreshing state...
module.cloud-nat.random_string.name_suffix: Creating...
module.cloud-nat.random_string.name_suffix: Creation complete after 0s [id=cvf01e]
module.gce-lb-http.google_compute_http_health_check.default[0]: Creating...
google_compute_network.default: Creating...
module.gce-lb-http.google_compute_global_address.default: Creating...
module.gce-lb-http.google_compute_http_health_check.default[0]: Creation complete after 4s [id=mig-http-lb-backend-0]
module.gce-lb-http.google_compute_global_address.default: Creation complete after 5s [id=mig-http-lb-address]
google_compute_network.default: Still creating... [10s elapsed]
google_compute_network.default: Creation complete after 17s [id=tf-lb-http-mig-nat]
google_compute_subnetwork.default: Creating...
module.gce-lb-http.google_compute_firewall.default-hc[0]: Creating...
google_compute_router.default: Creating...
google_compute_router.default: Creation complete after 4s [id=us-west1/lb-http-router]
module.cloud-nat.google_compute_router_nat.main: Creating...
module.gce-lb-http.google_compute_firewall.default-hc[0]: Creation complete after 8s [id=mig-http-lb-hc-0]
google_compute_subnetwork.default: Still creating... [10s elapsed]
module.cloud-nat.google_compute_router_nat.main: Still creating... [10s elapsed]
google_compute_subnetwork.default: Still creating... [20s elapsed]
module.cloud-nat.google_compute_router_nat.main: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-west1/lb-http-router/cloud-nat-lb-http-router]
google_compute_subnetwork.default: Creation complete after 28s [id=us-west1/tf-lb-http-mig-nat]
module.mig_template.google_compute_instance_template.tpl: Creating...
module.mig_template.google_compute_instance_template.tpl: Creation complete after 4s [id=tf-lb-http-mig-nat-20190930130648560700000001]
module.mig.google_compute_region_instance_group_manager.mig: Creating...
module.mig.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig.google_compute_region_instance_group_manager.mig: Still creating... [20s elapsed]
module.mig.google_compute_region_instance_group_manager.mig: Creation complete after 29s [id=gl-ivankorniienko-seed-251912/us-west1/tf-lb-http-mig-nat-mig]
module.gce-lb-http.google_compute_backend_service.default[0]: Creating...
module.gce-lb-http.google_compute_backend_service.default[0]: Creation complete after 9s [id=mig-http-lb-backend-0]
module.gce-lb-http.google_compute_url_map.default[0]: Creating...
module.gce-lb-http.google_compute_url_map.default[0]: Creation complete after 4s [id=mig-http-lb-url-map]
module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creating...
module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creation complete after 5s [id=mig-http-lb-http-proxy]
module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creating...
module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creation complete after 8s [id=mig-http-lb]
Apply complete! Resources: 14 added, 0 changed, 0 destroyed.
Outputs:
backend_services = [
"https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/global/backendServices/mig-http-lb-backend-0",
]
load-balancer-ip = 35.190.121.34
[16:19][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/mig-nat-http-lb]$ ./test.sh
+ set -e
++ terraform output load-balancer-ip
+ URL=http://35.190.121.34
+ status=0
+ count=0
+ [[ 0 -lt 720 ]]
+ [[ 0 -ne 200 ]]
+ echo 'INFO: Waiting for load balancer...'
INFO: Waiting for load balancer...
++ curl -sf -m 5 -o /dev/null -w '%{http_code}' http://35.190.121.34
+ status=200
+ (( count=count+1 ))
+ sleep 5
+ [[ 1 -lt 720 ]]
+ [[ 200 -ne 200 ]]
+ [[ 1 -lt 720 ]]
+ echo 'INFO: PASS'
INFO: PASS
multi-mig-http-lb
[16:12][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multi-mig-http-lb]$ terraform apply -auto-approve
module.mig1_template.data.google_compute_image.image_family: Refreshing state...
module.mig2.data.google_compute_zones.available: Refreshing state...
module.mig2_template.data.google_compute_image.image_family: Refreshing state...
module.mig1.data.google_compute_zones.available: Refreshing state...
module.mig1_template.data.google_compute_image.image: Refreshing state...
module.mig2_template.data.google_compute_image.image: Refreshing state...
data.template_file.group-startup-script: Refreshing state...
module.cloud-nat-group1.random_string.name_suffix: Creating...
module.cloud-nat-group2.random_string.name_suffix: Creating...
module.cloud-nat-group1.random_string.name_suffix: Creation complete after 0s [id=cob4u7]
module.gce-lb-http.google_compute_global_address.default: Creating...
google_compute_network.default: Creating...
module.cloud-nat-group2.random_string.name_suffix: Creation complete after 0s [id=3cf955]
module.gce-lb-http.google_compute_http_health_check.default[0]: Creating...
module.gce-lb-http.google_compute_http_health_check.default[0]: Creation complete after 5s [id=multi-mig-lb-http-backend-0]
module.gce-lb-http.google_compute_global_address.default: Creation complete after 9s [id=multi-mig-lb-http-address]
google_compute_network.default: Still creating... [10s elapsed]
google_compute_network.default: Creation complete after 18s [id=multi-mig-lb-http]
google_compute_router.group1: Creating...
google_compute_router.group2: Creating...
google_compute_subnetwork.group2: Creating...
google_compute_subnetwork.group1: Creating...
google_compute_router.group1: Creation complete after 4s [id=us-west1/multi-mig-lb-http-gw-group1]
module.cloud-nat-group1.google_compute_router_nat.main: Creating...
google_compute_router.group2: Creation complete after 4s [id=us-east1/multi-mig-lb-http-gw-group2]
module.cloud-nat-group2.google_compute_router_nat.main: Creating...
module.gce-lb-http.google_compute_firewall.default-hc[0]: Creating...
google_compute_subnetwork.group2: Still creating... [10s elapsed]
google_compute_subnetwork.group1: Still creating... [10s elapsed]
module.cloud-nat-group1.google_compute_router_nat.main: Still creating... [10s elapsed]
module.cloud-nat-group2.google_compute_router_nat.main: Still creating... [10s elapsed]
module.gce-lb-http.google_compute_firewall.default-hc[0]: Still creating... [10s elapsed]
google_compute_subnetwork.group2: Creation complete after 17s [id=us-east1/multi-mig-lb-http-group2]
module.mig2_template.google_compute_instance_template.tpl: Creating...
google_compute_subnetwork.group1: Creation complete after 17s [id=us-west1/multi-mig-lb-http-group1]
module.mig1_template.google_compute_instance_template.tpl: Creating...
module.gce-lb-http.google_compute_firewall.default-hc[0]: Creation complete after 17s [id=multi-mig-lb-http-hc-0]
module.mig2_template.google_compute_instance_template.tpl: Creation complete after 5s [id=multi-mig-lb-http-group2-20190930131312138600000001]
module.mig2.google_compute_region_instance_group_manager.mig: Creating...
module.mig1_template.google_compute_instance_template.tpl: Creation complete after 5s [id=multi-mig-lb-http-group1-20190930131312403200000002]
module.mig1.google_compute_region_instance_group_manager.mig: Creating...
module.cloud-nat-group1.google_compute_router_nat.main: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-west1/multi-mig-lb-http-gw-group1/multi-mig-lb-http-cloud-nat-group1]
module.cloud-nat-group2.google_compute_router_nat.main: Creation complete after 19s [id=gl-ivankorniienko-seed-251912/us-east1/multi-mig-lb-http-gw-group2/multi-mig-lb-http-cloud-nat-group2]
module.mig2.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig1.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig1.google_compute_region_instance_group_manager.mig: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-west1/multi-mig-lb-http-group1-mig]
module.mig2.google_compute_region_instance_group_manager.mig: Creation complete after 19s [id=gl-ivankorniienko-seed-251912/us-east1/multi-mig-lb-http-group2-mig]
module.gce-lb-http.google_compute_backend_service.default[0]: Creating...
module.gce-lb-http.google_compute_backend_service.default[0]: Creation complete after 8s [id=multi-mig-lb-http-backend-0]
module.gce-lb-http.google_compute_url_map.default[0]: Creating...
module.gce-lb-http.google_compute_url_map.default[0]: Creation complete after 4s [id=multi-mig-lb-http-url-map]
module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creating...
module.gce-lb-http.google_compute_target_http_proxy.default[0]: Creation complete after 5s [id=multi-mig-lb-http-http-proxy]
module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creating...
module.gce-lb-http.google_compute_global_forwarding_rule.http[0]: Creation complete after 9s [id=multi-mig-lb-http]
Apply complete! Resources: 20 added, 0 changed, 0 destroyed.
Outputs:
load-balancer-ip = 34.102.170.179
[16:14][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multi-mig-http-lb]$ ./test.sh
+ set -e
++ terraform output load-balancer-ip
+ URL=http://34.102.170.179
+ status=0
+ count=0
+ [[ 0 -lt 720 ]]
+ [[ 0 -ne 200 ]]
+ echo 'INFO: Waiting for load balancer...'
INFO: Waiting for load balancer...
++ curl -sf -m 5 -o /dev/null -w '%{http_code}' http://34.102.170.179
+ status=200
+ (( count=count+1 ))
+ sleep 5
+ [[ 1 -lt 720 ]]
+ [[ 200 -ne 200 ]]
+ [[ 1 -lt 720 ]]
+ echo 'INFO: PASS'
INFO: PASS
multi-backend-multi-mig-bucket-https-lb
[16:07][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multi-backend-multi-mig-bucket-https-lb]$ terraform apply -auto-approve
data.template_file.group2-startup-script: Refreshing state...
data.template_file.group1-startup-script: Refreshing state...
data.template_file.group3-startup-script: Refreshing state...
module.mig1_template.data.google_compute_image.image_family: Refreshing state...
module.mig2.data.google_compute_zones.available: Refreshing state...
module.mig3.data.google_compute_zones.available: Refreshing state...
module.mig3_template.data.google_compute_image.image_family: Refreshing state...
module.mig1.data.google_compute_zones.available: Refreshing state...
module.mig2_template.data.google_compute_image.image: Refreshing state...
module.mig2_template.data.google_compute_image.image_family: Refreshing state...
module.mig1_template.data.google_compute_image.image: Refreshing state...
module.mig3_template.data.google_compute_image.image: Refreshing state...
tls_private_key.example: Creating...
random_id.assets-bucket: Creating...
module.cloud-nat-group3.random_string.name_suffix: Creating...
module.cloud-nat-group2.random_string.name_suffix: Creating...
module.cloud-nat-group1.random_string.name_suffix: Creating...
random_id.assets-bucket: Creation complete after 0s [id=YTM]
module.cloud-nat-group3.random_string.name_suffix: Creation complete after 0s [id=7tiy1f]
module.gce-lb-https.google_compute_http_health_check.default[3]: Creating...
module.gce-lb-https.google_compute_http_health_check.default[0]: Creating...
module.gce-lb-https.google_compute_http_health_check.default[2]: Creating...
google_compute_network.default: Creating...
module.cloud-nat-group2.random_string.name_suffix: Creation complete after 0s [id=x27zpq]
module.cloud-nat-group1.random_string.name_suffix: Creation complete after 0s [id=o0zter]
module.gce-lb-https.google_compute_http_health_check.default[1]: Creating...
google_storage_bucket.assets: Creating...
module.gce-lb-https.google_compute_global_address.default: Creating...
tls_private_key.example: Creation complete after 0s [id=b3d84c7d2587d5eb59050fead25baab9869e0d64]
tls_self_signed_cert.example: Creating...
tls_self_signed_cert.example: Creation complete after 0s [id=155952164724064996225404034176530468967]
module.gce-lb-https.google_compute_ssl_certificate.default[0]: Creating...
google_storage_bucket.assets: Creation complete after 2s [id=terraform-static-content-6133]
google_compute_backend_bucket.assets: Creating...
google_storage_bucket_object.image: Creating...
google_storage_bucket_object.image: Creation complete after 1s [id=terraform-static-content-6133-assets/gcp-logo.svg]
google_storage_object_acl.image-acl: Creating...
google_storage_object_acl.image-acl: Creation complete after 0s [id=assets/gcp-logo.svg-acl]
module.gce-lb-https.google_compute_global_address.default: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-address]
module.gce-lb-https.google_compute_http_health_check.default[0]: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-backend-0]
module.gce-lb-https.google_compute_http_health_check.default[3]: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-backend-3]
module.gce-lb-https.google_compute_http_health_check.default[1]: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-backend-1]
module.gce-lb-https.google_compute_http_health_check.default[2]: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-backend-2]
module.gce-lb-https.google_compute_ssl_certificate.default[0]: Creation complete after 6s [id=ml-bk-ml-mig-bkt-s-lb-certificate-20190930130918335500000001]
google_compute_backend_bucket.assets: Creation complete after 4s [id=terraform-static-content-6133]
google_compute_network.default: Still creating... [10s elapsed]
google_compute_network.default: Creation complete after 17s [id=ml-bk-ml-mig-bkt-s-lb]
google_compute_subnetwork.group2: Creating...
google_compute_subnetwork.group1: Creating...
google_compute_router.group1: Creating...
google_compute_router.group2: Creating...
google_compute_router.group3: Creating...
google_compute_subnetwork.group3: Creating...
google_compute_router.group3: Creation complete after 5s [id=us-east1/ml-bk-ml-mig-bkt-s-lb-gw-group3]
module.cloud-nat-group3.google_compute_router_nat.main: Creating...
google_compute_router.group2: Creation complete after 5s [id=us-central1/ml-bk-ml-mig-bkt-s-lb-gw-group2]
module.cloud-nat-group2.google_compute_router_nat.main: Creating...
google_compute_router.group1: Creation complete after 5s [id=us-west1/ml-bk-ml-mig-bkt-s-lb-gw-group1]
module.cloud-nat-group1.google_compute_router_nat.main: Creating...
module.gce-lb-https.google_compute_firewall.default-hc[0]: Creating...
google_compute_subnetwork.group2: Still creating... [10s elapsed]
google_compute_subnetwork.group1: Still creating... [10s elapsed]
google_compute_subnetwork.group3: Still creating... [10s elapsed]
module.cloud-nat-group3.google_compute_router_nat.main: Still creating... [10s elapsed]
module.cloud-nat-group2.google_compute_router_nat.main: Still creating... [10s elapsed]
module.cloud-nat-group1.google_compute_router_nat.main: Still creating... [10s elapsed]
module.gce-lb-https.google_compute_firewall.default-hc[0]: Still creating... [10s elapsed]
google_compute_subnetwork.group2: Creation complete after 18s [id=us-central1/ml-bk-ml-mig-bkt-s-lb]
module.mig2_template.google_compute_instance_template.tpl: Creating...
google_compute_subnetwork.group1: Still creating... [20s elapsed]
google_compute_subnetwork.group3: Still creating... [20s elapsed]
module.gce-lb-https.google_compute_firewall.default-hc[0]: Creation complete after 17s [id=ml-bk-ml-mig-bkt-s-lb-hc-0]
module.cloud-nat-group2.google_compute_router_nat.main: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-central1/ml-bk-ml-mig-bkt-s-lb-gw-group2/ml-bk-ml-mig-bkt-s-lb-cloud-nat-group2]
module.mig2_template.google_compute_instance_template.tpl: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-group2-20190930130953170600000002]
module.mig2.google_compute_region_instance_group_manager.mig: Creating...
module.cloud-nat-group3.google_compute_router_nat.main: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-east1/ml-bk-ml-mig-bkt-s-lb-gw-group3/ml-bk-ml-mig-bkt-s-lb-cloud-nat-group3]
module.cloud-nat-group1.google_compute_router_nat.main: Creation complete after 20s [id=gl-ivankorniienko-seed-251912/us-west1/ml-bk-ml-mig-bkt-s-lb-gw-group1/ml-bk-ml-mig-bkt-s-lb-cloud-nat-group1]
google_compute_subnetwork.group3: Creation complete after 29s [id=us-east1/ml-bk-ml-mig-bkt-s-lb]
module.mig3_template.google_compute_instance_template.tpl: Creating...
google_compute_subnetwork.group1: Creation complete after 29s [id=us-west1/ml-bk-ml-mig-bkt-s-lb]
module.mig1_template.google_compute_instance_template.tpl: Creating...
module.mig2.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig3_template.google_compute_instance_template.tpl: Creation complete after 4s [id=ml-bk-ml-mig-bkt-s-lb-group3-20190930131003730300000003]
module.mig3.google_compute_region_instance_group_manager.mig: Creating...
module.mig1_template.google_compute_instance_template.tpl: Creation complete after 4s [id=ml-bk-ml-mig-bkt-s-lb-group1-20190930131003994700000004]
module.mig1.google_compute_region_instance_group_manager.mig: Creating...
module.mig2.google_compute_region_instance_group_manager.mig: Creation complete after 19s [id=gl-ivankorniienko-seed-251912/us-central1/ml-bk-ml-mig-bkt-s-lb-group2-mig]
module.mig3.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig1.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig1.google_compute_region_instance_group_manager.mig: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-west1/ml-bk-ml-mig-bkt-s-lb-group1-mig]
module.mig3.google_compute_region_instance_group_manager.mig: Creation complete after 19s [id=gl-ivankorniienko-seed-251912/us-east1/ml-bk-ml-mig-bkt-s-lb-group3-mig]
module.gce-lb-https.google_compute_backend_service.default[3]: Creating...
module.gce-lb-https.google_compute_backend_service.default[2]: Creating...
module.gce-lb-https.google_compute_backend_service.default[1]: Creating...
module.gce-lb-https.google_compute_backend_service.default[0]: Creating...
module.gce-lb-https.google_compute_backend_service.default[3]: Creation complete after 9s [id=ml-bk-ml-mig-bkt-s-lb-backend-3]
module.gce-lb-https.google_compute_backend_service.default[1]: Creation complete after 9s [id=ml-bk-ml-mig-bkt-s-lb-backend-1]
module.gce-lb-https.google_compute_backend_service.default[2]: Creation complete after 9s [id=ml-bk-ml-mig-bkt-s-lb-backend-2]
module.gce-lb-https.google_compute_backend_service.default[0]: Creation complete after 9s [id=ml-bk-ml-mig-bkt-s-lb-backend-0]
google_compute_url_map.ml-bkd-ml-mig-bckt-s-lb: Creating...
google_compute_url_map.ml-bkd-ml-mig-bckt-s-lb: Creation complete after 4s [id=ml-bk-ml-mig-bkt-s-lb]
module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creating...
module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creating...
module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-https-proxy]
module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creating...
module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creation complete after 5s [id=ml-bk-ml-mig-bkt-s-lb-http-proxy]
module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creating...
module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creation complete after 9s [id=ml-bk-ml-mig-bkt-s-lb-https]
module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creation complete after 9s [id=ml-bk-ml-mig-bkt-s-lb]
Apply complete! Resources: 42 added, 0 changed, 0 destroyed.
Outputs:
asset-url = https://35.190.47.152/assets/gcp-logo.svg
group1_region = us-west1
group2_region = us-central1
group3_region = us-east1
load-balancer-ip = 35.190.47.152
[16:20][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multi-backend-multi-mig-bucket-https-lb]$ ./test.sh
+ set -e
++ terraform output load-balancer-ip
+ URL=https://35.190.47.152
+ status=0
+ count=0
+ [[ 0 -lt 720 ]]
+ [[ 0 -ne 200 ]]
+ echo 'INFO: Waiting for load balancer...'
INFO: Waiting for load balancer...
++ curl -sfk -m 5 -o /dev/null -w '%{http_code}' https://35.190.47.152
+ status=200
+ (( count=count+1 ))
+ sleep 5
+ [[ 1 -lt 720 ]]
+ [[ 200 -ne 200 ]]
+ [[ 1 -lt 720 ]]
+ echo 'INFO: PASS. Load balancer is ready.'
INFO: PASS. Load balancer is ready.
++ terraform output group1_region
+ checkPattern https://35.190.47.152/group1 us-west1
+ local URL=https://35.190.47.152/group1
+ local pattern=us-west1
+ local count=0
+ [[ 0 -lt 120 ]]
+ echo 'INFO: Checking https://35.190.47.152/group1 for text: '\''us-west1'\''...'
INFO: Checking https://35.190.47.152/group1 for text: 'us-west1'...
+ curl -sfkL -m 5 https://35.190.47.152/group1
+ egrep -q us-west1
+ echo 'INFO: PASS. Found pattern: '\''us-west1'\'''
INFO: PASS. Found pattern: 'us-west1'
+ return 0
++ terraform output group2_region
+ checkPattern https://35.190.47.152/group2 us-central1
+ local URL=https://35.190.47.152/group2
+ local pattern=us-central1
+ local count=0
+ [[ 0 -lt 120 ]]
+ echo 'INFO: Checking https://35.190.47.152/group2 for text: '\''us-central1'\''...'
INFO: Checking https://35.190.47.152/group2 for text: 'us-central1'...
+ curl -sfkL -m 5 https://35.190.47.152/group2
+ egrep -q us-central1
+ echo 'INFO: PASS. Found pattern: '\''us-central1'\'''
INFO: PASS. Found pattern: 'us-central1'
+ return 0
++ terraform output group3_region
+ checkPattern https://35.190.47.152/group3 us-east1
+ local URL=https://35.190.47.152/group3
+ local pattern=us-east1
+ local count=0
+ [[ 0 -lt 120 ]]
+ echo 'INFO: Checking https://35.190.47.152/group3 for text: '\''us-east1'\''...'
INFO: Checking https://35.190.47.152/group3 for text: 'us-east1'...
+ curl -sfkL -m 5 https://35.190.47.152/group3
+ egrep -q us-east1
+ echo 'INFO: PASS. Found pattern: '\''us-east1'\'''
INFO: PASS. Found pattern: 'us-east1'
+ return 0
++ terraform output asset-url
+ checkFile https://35.190.47.152/assets/gcp-logo.svg
+ local URL=https://35.190.47.152/assets/gcp-logo.svg
+ local count=0
+ [[ 0 -lt 120 ]]
+ echo 'INFO: Checking https://35.190.47.152/assets/gcp-logo.svg...'
INFO: Checking https://35.190.47.152/assets/gcp-logo.svg...
++ curl -sfk -m 5 -o /dev/null -w '%{http_code}' https://35.190.47.152/assets/gcp-logo.svg
+ status=200
+ [[ 200 -eq 200 ]]
+ echo 'INFO: PASS'
INFO: PASS
+ return 0
+ echo 'INFO: PASS'
INFO: PASS
[16:23][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multi-backend-multi-mig-bucket-https-lb]$
multiple-certs
[16:29][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multiple-certs]$ terraform apply -auto-approve
data.template_file.group1-startup-script: Refreshing state...
data.template_file.group3-startup-script: Refreshing state...
data.template_file.group2-startup-script: Refreshing state...
module.mig3.data.google_compute_zones.available: Refreshing state...
module.mig1_template.data.google_compute_image.image: Refreshing state...
module.mig2_template.data.google_compute_image.image: Refreshing state...
module.mig1.data.google_compute_zones.available: Refreshing state...
module.mig3_template.data.google_compute_image.image_family: Refreshing state...
module.mig3_template.data.google_compute_image.image: Refreshing state...
module.mig2.data.google_compute_zones.available: Refreshing state...
module.mig2_template.data.google_compute_image.image_family: Refreshing state...
module.mig1_template.data.google_compute_image.image_family: Refreshing state...
tls_private_key.example[2]: Creating...
tls_private_key.example[1]: Creating...
module.gce-lb-https.google_compute_http_health_check.default[3]: Creating...
module.gce-lb-https.google_compute_http_health_check.default[2]: Creating...
module.gce-lb-https.google_compute_http_health_check.default[0]: Creating...
module.gce-lb-https.google_compute_http_health_check.default[1]: Creating...
tls_private_key.example[0]: Creating...
google_compute_network.default: Creating...
module.gce-lb-https.google_compute_global_address.default: Creating...
random_id.assets-bucket: Creating...
random_id.assets-bucket: Creation complete after 0s [id=pKo]
tls_private_key.example[2]: Creation complete after 0s [id=3ce60068d59a8d6a6b73a61cf292526b5ca7b114]
module.cloud-nat-group3.random_string.name_suffix: Creating...
module.cloud-nat-group3.random_string.name_suffix: Creation complete after 0s [id=uft46y]
module.cloud-nat-group1.random_string.name_suffix: Creating...
module.cloud-nat-group1.random_string.name_suffix: Creation complete after 0s [id=36k85d]
module.cloud-nat-group2.random_string.name_suffix: Creating...
module.cloud-nat-group2.random_string.name_suffix: Creation complete after 0s [id=lde4ks]
google_storage_bucket.assets: Creating...
tls_private_key.example[0]: Creation complete after 0s [id=8134f055ae34aed0f7bbf443787cf18dceb4736a]
tls_private_key.example[1]: Creation complete after 0s [id=a8096bf424ca20f573625963344511a5d6cb13ba]
tls_self_signed_cert.example[1]: Creating...
tls_self_signed_cert.example[2]: Creating...
tls_self_signed_cert.example[0]: Creating...
tls_self_signed_cert.example[1]: Creation complete after 0s [id=216242781241220125960364196765722932161]
tls_self_signed_cert.example[2]: Creation complete after 0s [id=23276013648070626990469855214950139355]
tls_self_signed_cert.example[0]: Creation complete after 0s [id=212462493976456971836502382098206996933]
google_compute_ssl_certificate.example[2]: Creating...
google_compute_ssl_certificate.example[1]: Creating...
google_compute_ssl_certificate.example[0]: Creating...
google_storage_bucket.assets: Creation complete after 1s [id=terraform-static-content-a4aa]
google_compute_backend_bucket.assets: Creating...
google_compute_ssl_certificate.example[2]: Creation complete after 4s [id=tf-lb-https-multi-cert-cert-3]
google_storage_bucket_object.image: Creating...
module.gce-lb-https.google_compute_http_health_check.default[2]: Creation complete after 4s [id=tf-lb-https-multi-cert-backend-2]
module.gce-lb-https.google_compute_http_health_check.default[3]: Creation complete after 4s [id=tf-lb-https-multi-cert-backend-3]
module.gce-lb-https.google_compute_http_health_check.default[0]: Creation complete after 4s [id=tf-lb-https-multi-cert-backend-0]
module.gce-lb-https.google_compute_global_address.default: Creation complete after 4s [id=tf-lb-https-multi-cert-address]
module.gce-lb-https.google_compute_http_health_check.default[1]: Creation complete after 5s [id=tf-lb-https-multi-cert-backend-1]
google_storage_bucket_object.image: Creation complete after 1s [id=terraform-static-content-a4aa-assets/gcp-logo.svg]
google_storage_object_acl.image-acl: Creating...
google_compute_ssl_certificate.example[1]: Creation complete after 5s [id=tf-lb-https-multi-cert-cert-2]
google_compute_ssl_certificate.example[0]: Creation complete after 5s [id=tf-lb-https-multi-cert-cert-1]
google_storage_object_acl.image-acl: Creation complete after 1s [id=assets/gcp-logo.svg-acl]
google_compute_network.default: Still creating... [10s elapsed]
google_compute_backend_bucket.assets: Creation complete after 8s [id=terraform-static-content-a4aa]
google_compute_network.default: Creation complete after 17s [id=tf-lb-https-multi-cert]
google_compute_router.group1: Creating...
google_compute_router.group3: Creating...
google_compute_subnetwork.group3: Creating...
google_compute_subnetwork.group2: Creating...
google_compute_subnetwork.group1: Creating...
google_compute_router.group2: Creating...
google_compute_router.group3: Creation complete after 4s [id=us-east1/tf-lb-https-multi-cert-gw-group3]
module.cloud-nat-group3.google_compute_router_nat.main: Creating...
google_compute_router.group2: Creation complete after 5s [id=us-central1/tf-lb-https-multi-cert-gw-group2]
module.cloud-nat-group2.google_compute_router_nat.main: Creating...
google_compute_router.group1: Creation complete after 5s [id=us-west1/tf-lb-https-multi-cert-gw-group1]
module.cloud-nat-group1.google_compute_router_nat.main: Creating...
module.gce-lb-https.google_compute_firewall.default-hc[0]: Creating...
google_compute_subnetwork.group2: Still creating... [10s elapsed]
google_compute_subnetwork.group1: Still creating... [10s elapsed]
google_compute_subnetwork.group3: Still creating... [10s elapsed]
module.cloud-nat-group3.google_compute_router_nat.main: Still creating... [10s elapsed]
module.cloud-nat-group2.google_compute_router_nat.main: Still creating... [10s elapsed]
module.cloud-nat-group1.google_compute_router_nat.main: Still creating... [10s elapsed]
module.gce-lb-https.google_compute_firewall.default-hc[0]: Still creating... [10s elapsed]
google_compute_subnetwork.group2: Creation complete after 17s [id=us-central1/tf-lb-https-multi-cert]
module.mig2_template.google_compute_instance_template.tpl: Creating...
google_compute_subnetwork.group3: Creation complete after 18s [id=us-east1/tf-lb-https-multi-cert]
module.mig3_template.google_compute_instance_template.tpl: Creating...
google_compute_subnetwork.group1: Still creating... [20s elapsed]
module.mig2_template.google_compute_instance_template.tpl: Creation complete after 4s [id=tf-lb-https-multi-cert-group2-20190930133022535800000001]
module.mig2.google_compute_region_instance_group_manager.mig: Creating...
module.cloud-nat-group3.google_compute_router_nat.main: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-east1/tf-lb-https-multi-cert-gw-group3/tf-lb-https-multi-cert-cloud-nat-group3]
module.gce-lb-https.google_compute_firewall.default-hc[0]: Creation complete after 17s [id=tf-lb-https-multi-cert-hc-0]
module.cloud-nat-group2.google_compute_router_nat.main: Creation complete after 17s [id=gl-ivankorniienko-seed-251912/us-central1/tf-lb-https-multi-cert-gw-group2/tf-lb-https-multi-cert-cloud-nat-group2]
module.cloud-nat-group1.google_compute_router_nat.main: Creation complete after 17s [id=gl-ivankorniienko-seed-251912/us-west1/tf-lb-https-multi-cert-gw-group1/tf-lb-https-multi-cert-cloud-nat-group1]
module.mig3_template.google_compute_instance_template.tpl: Creation complete after 4s [id=tf-lb-https-multi-cert-group3-20190930133023289400000002]
module.mig3.google_compute_region_instance_group_manager.mig: Creating...
google_compute_subnetwork.group1: Creation complete after 28s [id=us-west1/tf-lb-https-multi-cert]
module.mig1_template.google_compute_instance_template.tpl: Creating...
module.mig2.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig3.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig1_template.google_compute_instance_template.tpl: Creation complete after 5s [id=tf-lb-https-multi-cert-group1-20190930133033338400000003]
module.mig1.google_compute_region_instance_group_manager.mig: Creating...
module.mig2.google_compute_region_instance_group_manager.mig: Creation complete after 18s [id=gl-ivankorniienko-seed-251912/us-central1/tf-lb-https-multi-cert-group2-mig]
module.mig3.google_compute_region_instance_group_manager.mig: Creation complete after 20s [id=gl-ivankorniienko-seed-251912/us-east1/tf-lb-https-multi-cert-group3-mig]
module.mig1.google_compute_region_instance_group_manager.mig: Still creating... [10s elapsed]
module.mig1.google_compute_region_instance_group_manager.mig: Creation complete after 19s [id=gl-ivankorniienko-seed-251912/us-west1/tf-lb-https-multi-cert-group1-mig]
module.gce-lb-https.google_compute_backend_service.default[2]: Creating...
module.gce-lb-https.google_compute_backend_service.default[1]: Creating...
module.gce-lb-https.google_compute_backend_service.default[3]: Creating...
module.gce-lb-https.google_compute_backend_service.default[0]: Creating...
module.gce-lb-https.google_compute_backend_service.default[3]: Creation complete after 8s [id=tf-lb-https-multi-cert-backend-3]
module.gce-lb-https.google_compute_backend_service.default[2]: Creation complete after 8s [id=tf-lb-https-multi-cert-backend-2]
module.gce-lb-https.google_compute_backend_service.default[1]: Creation complete after 8s [id=tf-lb-https-multi-cert-backend-1]
module.gce-lb-https.google_compute_backend_service.default[0]: Creation complete after 8s [id=tf-lb-https-multi-cert-backend-0]
google_compute_url_map.https-multi-cert: Creating...
google_compute_url_map.https-multi-cert: Creation complete after 5s [id=tf-lb-https-multi-cert]
module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creating...
module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creating...
module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creation complete after 4s [id=tf-lb-https-multi-cert-http-proxy]
module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creating...
module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creation complete after 4s [id=tf-lb-https-multi-cert-https-proxy]
module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creating...
module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creation complete after 9s [id=tf-lb-https-multi-cert]
module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creation complete after 9s [id=tf-lb-https-multi-cert-https]
Apply complete! Resources: 48 added, 0 changed, 0 destroyed.
Outputs:
asset-url = https://35.190.126.194/assets/gcp-logo.svg
group1_region = us-west1
group2_region = us-central1
group3_region = us-east1
load-balancer-ip = 35.190.126.194
[16:34][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multiple-certs]$ ./test.sh
+ set -e
++ terraform output load-balancer-ip
+ URL=https://35.190.126.194
+ status=0
+ count=0
+ [[ 0 -lt 720 ]]
+ [[ 0 -ne 200 ]]
+ echo 'INFO: Waiting for load balancer...'
INFO: Waiting for load balancer...
++ curl -sfk -m 5 -o /dev/null -w '%{http_code}' https://35.190.126.194
+ status=200
+ (( count=count+1 ))
+ sleep 5
+ [[ 1 -lt 720 ]]
+ [[ 200 -ne 200 ]]
+ [[ 1 -lt 720 ]]
+ echo 'INFO: PASS. Load balancer is ready.'
INFO: PASS. Load balancer is ready.
++ terraform output group1_region
+ checkPattern https://35.190.126.194/group1 us-west1
+ local URL=https://35.190.126.194/group1
+ local pattern=us-west1
+ local count=0
+ [[ 0 -lt 120 ]]
+ echo 'INFO: Checking https://35.190.126.194/group1 for text: '\''us-west1'\''...'
INFO: Checking https://35.190.126.194/group1 for text: 'us-west1'...
+ curl -sfkL -m 5 https://35.190.126.194/group1
+ egrep -q us-west1
+ echo 'INFO: PASS. Found pattern: '\''us-west1'\'''
INFO: PASS. Found pattern: 'us-west1'
+ return 0
++ terraform output group2_region
+ checkPattern https://35.190.126.194/group2 us-central1
+ local URL=https://35.190.126.194/group2
+ local pattern=us-central1
+ local count=0
+ [[ 0 -lt 120 ]]
+ echo 'INFO: Checking https://35.190.126.194/group2 for text: '\''us-central1'\''...'
INFO: Checking https://35.190.126.194/group2 for text: 'us-central1'...
+ curl -sfkL -m 5 https://35.190.126.194/group2
+ egrep -q us-central1
+ echo 'INFO: PASS. Found pattern: '\''us-central1'\'''
INFO: PASS. Found pattern: 'us-central1'
+ return 0
++ terraform output group3_region
+ checkPattern https://35.190.126.194/group3 us-east1
+ local URL=https://35.190.126.194/group3
+ local pattern=us-east1
+ local count=0
+ [[ 0 -lt 120 ]]
+ echo 'INFO: Checking https://35.190.126.194/group3 for text: '\''us-east1'\''...'
INFO: Checking https://35.190.126.194/group3 for text: 'us-east1'...
+ curl -sfkL -m 5 https://35.190.126.194/group3
+ egrep -q us-east1
+ echo 'INFO: PASS. Found pattern: '\''us-east1'\'''
INFO: PASS. Found pattern: 'us-east1'
+ return 0
+ status=0
+++ terraform output asset-url
++ curl -sfk -m 5 -o /dev/null -w '%{http_code}' https://35.190.126.194/assets/gcp-logo.svg
+ status=200
+ [[ 200 -eq 200 ]]
+ echo 'INFO: PASS. Assets served from GCS bucket.'
INFO: PASS. Assets served from GCS bucket.
+ echo 'INFO: PASS'
INFO: PASS
[16:44][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/multiple-certs]$
https-gke
[16:44][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke/gke-node-port]$ terraform apply -auto-approve
data.google_client_config.current: Refreshing state...
data.google_container_engine_versions.default: Refreshing state...
google_compute_network.default: Creating...
google_compute_network.default: Still creating... [10s elapsed]
google_compute_network.default: Creation complete after 17s [id=tf-lb-https-gke]
google_compute_subnetwork.default: Creating...
google_compute_subnetwork.default: Still creating... [10s elapsed]
google_compute_subnetwork.default: Creation complete after 18s [id=us-central1/tf-lb-https-gke]
google_container_cluster.default: Creating...
google_container_cluster.default: Still creating... [10s elapsed]
google_container_cluster.default: Still creating... [20s elapsed]
google_container_cluster.default: Still creating... [30s elapsed]
google_container_cluster.default: Still creating... [40s elapsed]
google_container_cluster.default: Still creating... [50s elapsed]
google_container_cluster.default: Still creating... [1m0s elapsed]
google_container_cluster.default: Still creating... [1m10s elapsed]
google_container_cluster.default: Still creating... [1m20s elapsed]
google_container_cluster.default: Still creating... [1m30s elapsed]
google_container_cluster.default: Still creating... [1m40s elapsed]
google_container_cluster.default: Still creating... [1m50s elapsed]
google_container_cluster.default: Still creating... [2m0s elapsed]
google_container_cluster.default: Still creating... [2m10s elapsed]
google_container_cluster.default: Still creating... [2m20s elapsed]
google_container_cluster.default: Still creating... [2m30s elapsed]
google_container_cluster.default: Still creating... [2m40s elapsed]
google_container_cluster.default: Still creating... [2m50s elapsed]
google_container_cluster.default: Still creating... [3m0s elapsed]
google_container_cluster.default: Still creating... [3m10s elapsed]
google_container_cluster.default: Still creating... [3m20s elapsed]
google_container_cluster.default: Creation complete after 3m22s [id=tf-lb-https-gke]
null_resource.default: Creating...
null_resource.default: Provisioning with 'local-exec'...
null_resource.default (local-exec): Executing: ["/bin/sh" "-c" "gcloud compute instance-groups set-named-ports https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/zones/us-central1-f/instanceGroups/gke-tf-lb-https-gke-default-pool-d2fb6a2b-grp --named-ports=http:30000 --format=json"]
kubernetes_service.nginx: Creating...
kubernetes_replication_controller.nginx: Creating...
kubernetes_service.nginx: Creation complete after 1s [id=default/nginx]
kubernetes_replication_controller.nginx: Creation complete after 1s [id=default/nginx]
null_resource.default (local-exec): Updated [https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/zones/us-central1-f/instanceGroups/gke-tf-lb-https-gke-default-pool-d2fb6a2b-grp].
null_resource.default (local-exec): [
null_resource.default (local-exec): {
null_resource.default (local-exec): "creationTimestamp": "2019-09-30T06:45:06.436-07:00",
null_resource.default (local-exec): "description": "This instance group is controlled by Instance Group Manager 'gke-tf-lb-https-gke-default-pool-d2fb6a2b-grp'. To modify instances in this group, use the Instance Group Manager API: https://cloud.google.com/compute/docs/reference/latest/instanceGroupManagers",
null_resource.default (local-exec): "fingerprint": "LAtzYU80Jew=",
null_resource.default (local-exec): "id": "6610846774108076045",
null_resource.default (local-exec): "kind": "compute#instanceGroup",
null_resource.default (local-exec): "name": "gke-tf-lb-https-gke-default-pool-d2fb6a2b-grp",
null_resource.default (local-exec): "namedPorts": [
null_resource.default (local-exec): {
null_resource.default (local-exec): "name": "http",
null_resource.default (local-exec): "port": 30000
null_resource.default (local-exec): }
null_resource.default (local-exec): ],
null_resource.default (local-exec): "network": "https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/global/networks/tf-lb-https-gke",
null_resource.default (local-exec): "selfLink": "https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/zones/us-central1-f/instanceGroups/gke-tf-lb-https-gke-default-pool-d2fb6a2b-grp",
null_resource.default (local-exec): "size": 3,
null_resource.default (local-exec): "subnetwork": "https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/regions/us-central1/subnetworks/tf-lb-https-gke",
null_resource.default (local-exec): "zone": "https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/zones/us-central1-f"
null_resource.default (local-exec): }
null_resource.default (local-exec): ]
null_resource.default: Creation complete after 7s [id=273815400957194642]
Apply complete! Resources: 6 added, 0 changed, 0 destroyed.
Outputs:
cluster_name = tf-lb-https-gke
instance_group = https://www.googleapis.com/compute/v1/projects/gl-ivankorniienko-seed-251912/zones/us-central1-f/instanceGroups/gke-tf-lb-https-gke-default-pool-d2fb6a2b-grp
network_name = tf-lb-https-gke
node_tag = tf-lb-https-gke
port_name = http
port_number = 30000
[16:48][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke/gke-node-port]$ cd ..
[16:49][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke]$ export TF_VAR_backend=$(terraform output -state gke-node-port/terraform.tfstate instance_group)
[16:49][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke]$ export TF_VAR_target_tags=$(terraform output -state gke-node-port/terraform.tfstate node_tag)
[16:49][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke]$ export TF_VAR_network_name=$(terraform output -state gke-node-port/terraform.tfstate network_name)
[16:49][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke]$ export TF_VAR_project=$GOOGLE_PROJECT
[16:49][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke]$ terraform apply -auto-approve
data.google_client_config.current: Refreshing state...
random_id.assets-bucket: Creating...
module.gce-lb-https.google_compute_global_address.default: Creating...
random_id.assets-bucket: Creation complete after 0s [id=Eqk]
module.gce-lb-https.google_compute_http_health_check.default[0]: Creating...
module.gce-lb-https.google_compute_firewall.default-hc[0]: Creating...
google_storage_bucket.assets: Creating...
tls_private_key.example: Creating...
tls_private_key.example: Creation complete after 0s [id=b792f07eaef39063c6a879c049bb6defebca186d]
tls_self_signed_cert.example: Creating...
tls_self_signed_cert.example: Creation complete after 0s [id=169384378817886980273168713940772572358]
module.gce-lb-https.google_compute_ssl_certificate.default[0]: Creating...
google_storage_bucket.assets: Creation complete after 1s [id=gl-ivankorniienko-seed-251912-lb-assets-12a9]
google_compute_backend_bucket.assets: Creating...
google_storage_bucket_object.image: Creating...
google_storage_bucket_object.image: Creation complete after 1s [id=gl-ivankorniienko-seed-251912-lb-assets-12a9-assets/gcp-logo.svg]
google_storage_object_acl.image-acl: Creating...
google_storage_object_acl.image-acl: Creation complete after 1s [id=assets/gcp-logo.svg-acl]
module.gce-lb-https.google_compute_ssl_certificate.default[0]: Creation complete after 4s [id=tf-lb-https-gke-certificate-20190930134935745700000001]
module.gce-lb-https.google_compute_http_health_check.default[0]: Creation complete after 4s [id=tf-lb-https-gke-backend-0]
module.gce-lb-https.google_compute_backend_service.default[0]: Creating...
google_compute_backend_bucket.assets: Creation complete after 4s [id=gl-ivankorniienko-seed-251912-lb-assets-12a9]
module.gce-lb-https.google_compute_global_address.default: Creation complete after 9s [id=tf-lb-https-gke-address]
module.gce-lb-https.google_compute_firewall.default-hc[0]: Still creating... [10s elapsed]
module.gce-lb-https.google_compute_backend_service.default[0]: Creation complete after 9s [id=tf-lb-https-gke-backend-0]
google_compute_url_map.my-url-map: Creating...
module.gce-lb-https.google_compute_firewall.default-hc[0]: Creation complete after 17s [id=tf-lb-https-gke-hc-0]
google_compute_url_map.my-url-map: Creation complete after 4s [id=tf-lb-https-gke]
module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creating...
module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creating...
module.gce-lb-https.google_compute_target_https_proxy.default[0]: Creation complete after 6s [id=tf-lb-https-gke-https-proxy]
module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creating...
module.gce-lb-https.google_compute_target_http_proxy.default[0]: Creation complete after 7s [id=tf-lb-https-gke-http-proxy]
module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creating...
module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Still creating... [10s elapsed]
module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Still creating... [10s elapsed]
module.gce-lb-https.google_compute_global_forwarding_rule.https[0]: Creation complete after 16s [id=tf-lb-https-gke-https]
module.gce-lb-https.google_compute_global_forwarding_rule.http[0]: Creation complete after 17s [id=tf-lb-https-gke]
Apply complete! Resources: 17 added, 0 changed, 0 destroyed.
Outputs:
load-balancer-ip = 34.102.227.254
[16:50][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke]$ ./test.sh
+ set -e
++ terraform output load-balancer-ip
+ URL=https://34.102.227.254
+ status=0
+ count=0
+ [[ 0 -lt 720 ]]
+ [[ 0 -ne 200 ]]
+ echo 'INFO: Waiting for load balancer...'
INFO: Waiting for load balancer...
++ curl -sfk -m 5 -o /dev/null -w '%{http_code}' https://34.102.227.254
+ status=200
+ (( count=count+1 ))
+ sleep 5
+ [[ 1 -lt 720 ]]
+ [[ 200 -ne 200 ]]
+ [[ 1 -lt 720 ]]
+ echo 'INFO: PASS. Load balancer is ready.'
INFO: PASS. Load balancer is ready.
[17:06][user@host:/home/data/workspace/google/terraform-google-lb-http/examples/https-gke]$
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as discussed terraform-google-modules#52 (comment) - Simplified firewall rules logic as discussed terraform-google-modules#52 (comment) - Adjusted provider configuration as discussed terraform-google-modules#52 (comment) - Replaced not migrated module call with local_exec in null_resource as discussed terraform-google-modules#52 (comment) - Re-formatted main module output as discussed terraform-google-modules#52 (comment) - Re-named https-gke example input variable as discussed terraform-google-modules#52 (comment)
variables.tf
Outdated
description = "Map backend indices to list of backend maps." | ||
type = "map" | ||
type = map(list(object({ | ||
group = string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me clarify this request. The internal object should include each key which is retrieved in the configuration, and each key should be typed correctly. Only specifying group
in this signature is not valid because any other key in an object passed to this variable will be ignored.
balancing_mode = string
capacity_scaler = string
description = string
group = string
max_connections = number
max_connections_per_instance = number
max_rate = number
max_rate_per_instance = number
max_utilization = number
Calling configurations can provide objects with some values to null
if they only need to configure some keys. Additionally, the code in main.tf
which uses this object will not need to provide null
values because that will be handled by the calling configuration.
Examples should be updated to adhere to the new object signature.
- Removed trailing whitespaces - Migrated to 0.12 TF syntax in README - Corrected shell variables - Moved ouptus and variables into separated files as discussed terraform-google-modules#52 (comment) - Simplified firewall rules logic as discussed terraform-google-modules#52 (comment) - Adjusted provider configuration as discussed terraform-google-modules#52 (comment) - Replaced not migrated module call with local_exec in null_resource as discussed terraform-google-modules#52 (comment) - Re-formatted main module output as discussed terraform-google-modules#52 (comment) - Re-named https-gke example input variable as discussed terraform-google-modules#52 (comment) - Enforced backend params validation as discussed https://github.com/terraform-google-modules/terraform-google-lb-http/pull/52/files/42602b96de3e1eaa0f974e3f613a228edf64d322#r329202314
I incorrectly identified this a as a string rather than a number.
One of the last changes in PR terraform-google-modules#52 (Terraform 0.12 compatibility) was to make all of these attributes required, or explicitly set to null if we do not want to change the default values. The implementation across the example code was updated, but it looks like this entry in the README was missed
Fixes #51
Module:
Examples:
module vm
) and Debian based Linux'esKnown Issues:
shared vpc
example is currently broken and fails on creating an instancetemplate with shared network. Reported as instance template module: attempt to use
subnetwork_project
variabe fails with API error for not supported cross-project reference terraform-google-vm#29https-gke
example uses not migrated to 0.12 named_ports module which doesn't seem to have migrated replacement.for_each
for creating multiple instances of resources has been separated intofor_each
branch which got migration to newergoogle_compute_health_check
as wellTO DO: