Guest User

Untitled

a guest
Oct 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. resource "google_compute_network" "vpc" {
  2. name = "${var.cluster_name}-network"
  3. auto_create_subnetworks = false
  4. }
  5.  
  6. data "null_data_source" "subnetwork_names" {
  7. inputs {
  8. secondary_nodes_subnetwork = "${var.cluster_name}-nodes-secondary"
  9. secondary_services_subnetwork = "${var.cluster_name}-svc-range-secondary"
  10. }
  11. }
  12.  
  13. resource "google_compute_subnetwork" "k8snodes" {
  14. ip_cidr_range = "${var.cluster_nodes_cidr_block}"
  15. name = "${var.cluster_name}-nodes-subnetwork"
  16. network = "${google_compute_network.vpc.id}"
  17.  
  18. private_ip_google_access = true
  19.  
  20. secondary_ip_range {
  21. ip_cidr_range = "${var.cluster_nodes_secondary_cidr_block}"
  22. range_name = "${data.null_data_source.subnetwork_names.outputs["secondary_nodes_subnetwork"]}"
  23. }
  24.  
  25. secondary_ip_range {
  26. ip_cidr_range = "${var.cluster_services_secondary_cidr_block}"
  27. range_name = "${data.null_data_source.subnetwork_names.outputs["secondary_services_subnetwork"]}"
  28. }
  29. }
  30.  
  31. resource "google_compute_firewall" "allow_icmp_vpc_internal_egress" {
  32. name = "${var.cluster_name}-allow-icmp-egress"
  33. network = "${google_compute_network.vpc.self_link}"
  34.  
  35. allow {
  36. protocol = "icmp"
  37. }
  38.  
  39. direction = "EGRESS"
  40.  
  41. destination_ranges = [
  42. "0.0.0.0/0",
  43. ]
  44. }
  45.  
  46. resource "google_compute_firewall" "allow_icmp_vpc_internal_ingress" {
  47. name = "${var.cluster_name}-allow-icmp-ingress"
  48. network = "${google_compute_network.vpc.self_link}"
  49.  
  50. allow {
  51. protocol = "icmp"
  52. }
  53.  
  54. direction = "INGRESS"
  55.  
  56. source_ranges = [
  57. "0.0.0.0/0",
  58. ]
  59. }
Add Comment
Please, Sign In to add comment