Skip to content

Commit

Permalink
net-ilb: add example about ref existing MIG example (GoogleCloudPlatf…
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaPrete authored Feb 11, 2023
1 parent 98a08c1 commit 3a0a1e2
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions modules/net-ilb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,62 @@ One other issue is a `Provider produced inconsistent final plan` error which is

## Examples

### Reference existing MIGs

This example shows how to reference existing Managed Infrastructure Groups (MIGs).

```hcl
module "instance_template" {
source = "./fabric/modules/compute-vm"
project_id = var.project_id
create_template = true
name = "vm-test"
service_account_create = true
zone = "europe-west1-b"
network_interfaces = [
{
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
]
tags = [
"http-server"
]
}
module "mig" {
source = "./fabric/modules/compute-mig"
project_id = var.project_id
location = "europe-west1"
name = "mig-test"
target_size = 1
instance_template = module.instance_template.template.self_link
}
module "ilb" {
source = "./fabric/modules/net-ilb"
project_id = var.project_id
region = "europe-west1"
name = "ilb-test"
service_label = "ilb-test"
vpc_config = {
network = var.vpc.self_link
subnetwork = var.subnet.self_link
}
backends = [{
group = module.mig.group_manager.instance_group
}]
health_check_config = {
http = {
port = 80
}
}
}
# tftest modules=3 resources=6
```

### Externally managed instances

This examples shows how to create an ILB by combining externally managed instances (in a custom module or even outside of the current root module) in an unmanaged group. When using internally managed groups, remember to run `terraform apply` each time group instances change.
Expand Down

0 comments on commit 3a0a1e2

Please sign in to comment.