Skip to content

Commit

Permalink
Add mutex, pull extra values from group
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson committed Mar 19, 2020
1 parent 417e319 commit c2798f6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
InstanceGroupNamedPort: !ruby/object:Overrides::Terraform::ResourceOverride
id_format: 'projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}'
import_format: ['projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}']
mutex: 'projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}'
examples:
- !ruby/object:Provider::Terraform::Examples
name: "instance_group_named_port_gke"
Expand Down
11 changes: 10 additions & 1 deletion templates/terraform/encoders/normalize_group.go.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
d.Set("group", GetResourceNameFromSelfLink(d.Get("group").(string)))
config := meta.(*Config)
ig, err := ParseInstanceGroupFieldValue(d.Get("group").(string), d, config)
if err != nil {
return nil, err
}

d.Set("group", ig.Name)
d.Set("zone", ig.Zone)
d.Set("project", ig.Project)

return obj, nil
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_i
port = 8080
}

resource "google_compute_instance_group_named_port" "<%= ctx[:primary_resource_id] %>s" {
group = google_container_cluster.my_cluster.instance_group_urls[0]
zone = "us-central1-a"

name = "https"
port = 4443
}

resource "google_compute_network" "container_network" {
name = "<%= ctx[:vars]['network_name'] %>"
auto_create_subnetworks = false
Expand Down

0 comments on commit c2798f6

Please sign in to comment.