My rule of a thumb to create Terraform module is when I need to repeat myself more than 3 times.
Here are my notes on how to create a simple Terraform module for two resources which you need to
keep defining for each backend google_compute_region_network_endpoint_group and google_compute_backend_service.
Create a module
Module structure in sub-folder: ./modules/backend:
So it requires two variables region and run_service_name:
Finally, it also requires one output which can be used later in google_compute_url_map:
How to use the module.
Old code:
New code:
Before you can use module you need to run terraform init. If all is good terraform plan
should notice items moved and no changes should be proposed.