Skip to content

Commit

Permalink
Adding ipv4 range back (#599)
Browse files Browse the repository at this point in the history
Merged PR #599.
  • Loading branch information
chrisst authored and modular-magician committed Oct 23, 2018
1 parent 3c57805 commit 136d4e7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build/ansible
Submodule ansible updated 88 files
+141 −133 lib/ansible/modules/cloud/google/gcp_compute_address.py
+81 −81 lib/ansible/modules/cloud/google/gcp_compute_address_facts.py
+75 −73 lib/ansible/modules/cloud/google/gcp_compute_backend_bucket.py
+49 −50 lib/ansible/modules/cloud/google/gcp_compute_backend_bucket_facts.py
+493 −465 lib/ansible/modules/cloud/google/gcp_compute_backend_service.py
+274 −268 lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py
+314 −314 lib/ansible/modules/cloud/google/gcp_compute_disk.py
+200 −200 lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py
+335 −325 lib/ansible/modules/cloud/google/gcp_compute_firewall.py
+182 −178 lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py
+313 −294 lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py
+162 −159 lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py
+95 −89 lib/ansible/modules/cloud/google/gcp_compute_global_address.py
+63 −63 lib/ansible/modules/cloud/google/gcp_compute_global_address_facts.py
+279 −264 lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py
+147 −145 lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py
+400 −385 lib/ansible/modules/cloud/google/gcp_compute_health_check.py
+223 −221 lib/ansible/modules/cloud/google/gcp_compute_health_check_facts.py
+137 −133 lib/ansible/modules/cloud/google/gcp_compute_http_health_check.py
+83 −83 lib/ansible/modules/cloud/google/gcp_compute_http_health_check_facts.py
+134 −131 lib/ansible/modules/cloud/google/gcp_compute_https_health_check.py
+83 −83 lib/ansible/modules/cloud/google/gcp_compute_https_health_check_facts.py
+328 −323 lib/ansible/modules/cloud/google/gcp_compute_image.py
+212 −209 lib/ansible/modules/cloud/google/gcp_compute_image_facts.py
+719 −697 lib/ansible/modules/cloud/google/gcp_compute_instance.py
+414 −404 lib/ansible/modules/cloud/google/gcp_compute_instance_facts.py
+145 −143 lib/ansible/modules/cloud/google/gcp_compute_instance_group.py
+89 −90 lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py
+214 −210 lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager.py
+164 −162 lib/ansible/modules/cloud/google/gcp_compute_instance_group_manager_facts.py
+723 −691 lib/ansible/modules/cloud/google/gcp_compute_instance_template.py
+400 −382 lib/ansible/modules/cloud/google/gcp_compute_instance_template_facts.py
+120 −118 lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment.py
+93 −93 lib/ansible/modules/cloud/google/gcp_compute_interconnect_attachment_facts.py
+135 −130 lib/ansible/modules/cloud/google/gcp_compute_network.py
+82 −82 lib/ansible/modules/cloud/google/gcp_compute_network_facts.py
+249 −249 lib/ansible/modules/cloud/google/gcp_compute_region_disk.py
+161 −162 lib/ansible/modules/cloud/google/gcp_compute_region_disk_facts.py
+164 −162 lib/ansible/modules/cloud/google/gcp_compute_route.py
+86 −87 lib/ansible/modules/cloud/google/gcp_compute_route_facts.py
+157 −150 lib/ansible/modules/cloud/google/gcp_compute_router.py
+99 −98 lib/ansible/modules/cloud/google/gcp_compute_router_facts.py
+74 −72 lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py
+50 −51 lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py
+129 −118 lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py
+88 −88 lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py
+183 −181 lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py
+108 −108 lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py
+66 −63 lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py
+44 −44 lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py
+100 −93 lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py
+60 −59 lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py
+176 −171 lib/ansible/modules/cloud/google/gcp_compute_target_pool.py
+101 −102 lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py
+91 −86 lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py
+56 −56 lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py
+79 −75 lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py
+49 −50 lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py
+83 −81 lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py
+63 −63 lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py
+243 −235 lib/ansible/modules/cloud/google/gcp_compute_url_map.py
+142 −140 lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py
+163 −161 lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py
+101 −101 lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py
+495 −478 lib/ansible/modules/cloud/google/gcp_container_cluster.py
+304 −299 lib/ansible/modules/cloud/google/gcp_container_cluster_facts.py
+344 −337 lib/ansible/modules/cloud/google/gcp_container_node_pool.py
+202 −200 lib/ansible/modules/cloud/google/gcp_container_node_pool_facts.py
+72 −70 lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py
+52 −52 lib/ansible/modules/cloud/google/gcp_dns_managed_zone_facts.py
+80 −66 lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py
+44 −44 lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_facts.py
+94 −92 lib/ansible/modules/cloud/google/gcp_pubsub_subscription.py
+52 −50 lib/ansible/modules/cloud/google/gcp_pubsub_subscription_facts.py
+20 −18 lib/ansible/modules/cloud/google/gcp_pubsub_topic.py
+14 −13 lib/ansible/modules/cloud/google/gcp_pubsub_topic_facts.py
+53 −49 lib/ansible/modules/cloud/google/gcp_spanner_database.py
+37 −36 lib/ansible/modules/cloud/google/gcp_spanner_database_facts.py
+96 −94 lib/ansible/modules/cloud/google/gcp_spanner_instance.py
+55 −53 lib/ansible/modules/cloud/google/gcp_spanner_instance_facts.py
+54 −52 lib/ansible/modules/cloud/google/gcp_sql_database.py
+38 −38 lib/ansible/modules/cloud/google/gcp_sql_database_facts.py
+464 −447 lib/ansible/modules/cloud/google/gcp_sql_instance.py
+271 −264 lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py
+56 −54 lib/ansible/modules/cloud/google/gcp_sql_user.py
+39 −39 lib/ansible/modules/cloud/google/gcp_sql_user_facts.py
+682 −644 lib/ansible/modules/cloud/google/gcp_storage_bucket.py
+119 −113 lib/ansible/modules/cloud/google/gcp_storage_bucket_access_control.py
2 changes: 1 addition & 1 deletion build/inspec
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
18 changes: 13 additions & 5 deletions provider/terraform/resources/resource_compute_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func resourceComputeNetwork() *schema.Resource {
Optional: true,
ForceNew: true,
// This needs to remain deprecated until the API is retired
Removed: "Please use google_compute_subnetwork resources instead.",
Deprecated: "Please use google_compute_subnetwork resources instead.",
},

"project": &schema.Schema{
Expand Down Expand Up @@ -89,6 +89,9 @@ func resourceComputeNetworkCreate(d *schema.ResourceData, meta interface{}) erro
// - 2.b - Custom subnet mode - auto_create_subnetworks = false & ipv4_range not set,
//
autoCreateSubnetworks := d.Get("auto_create_subnetworks").(bool)
if autoCreateSubnetworks && d.Get("ipv4_range").(string) != "" {
return fmt.Errorf("ipv4_range can't be set if auto_create_subnetworks is true.")
}

// Build the network parameter
network := &compute.Network{
Expand All @@ -104,10 +107,14 @@ func resourceComputeNetworkCreate(d *schema.ResourceData, meta interface{}) erro
network.RoutingConfig = routingConfig
}

// make sure AutoCreateSubnetworks field is included in request otherwise
// google will create a network in legacy mode.
network.ForceSendFields = []string{"AutoCreateSubnetworks"}

if v, ok := d.GetOk("ipv4_range"); ok {
log.Printf("[DEBUG] Setting IPv4Range (%#v) for legacy network mode", v.(string))
network.IPv4Range = v.(string)
} else {
// custom subnet mode, so make sure AutoCreateSubnetworks field is included in request otherwise
// google will create a network in legacy mode.
network.ForceSendFields = []string{"AutoCreateSubnetworks"}
}
log.Printf("[DEBUG] Network insert request: %#v", network)
op, err := config.clientCompute.Networks.Insert(
project, network).Do()
Expand Down Expand Up @@ -144,6 +151,7 @@ func resourceComputeNetworkRead(d *schema.ResourceData, meta interface{}) error

d.Set("routing_mode", routingConfig.RoutingMode)
d.Set("gateway_ipv4", network.GatewayIPv4)
d.Set("ipv4_range", network.IPv4Range)
d.Set("self_link", network.SelfLink)
d.Set("name", network.Name)
d.Set("description", network.Description)
Expand Down

0 comments on commit 136d4e7

Please sign in to comment.