Guest User

Untitled

a guest
Nov 22nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. resource "openstack_networking_subnet_v2" "s1_public" {
  2. count = "${var.is_ipv6+1}"
  3. name = "${var.cdn_name}s1.pub_v${count.index == 0 ? 4 : 6}-${var.user_name}"
  4. network_id = "${openstack_networking_network_v2.s1_public.id}"
  5. cidr = "${element(var.cdn_ipnets["s1_public"], count.index)}"
  6. ip_version = "${ count.index == 0 ? 4 : 6 }"
  7. }
  8.  
  9. data "null_data_source" "s1_public_gw_ips" {
  10. count = "${var.is_ipv6+1}"
  11. depends_on = [ "openstack_networking_subnet_v2.s1_public" ]
  12.  
  13. inputs = {
  14. subnet_id = "${openstack_networking_subnet_v2.s1_public.*.id[count.index]}"
  15. ip_address = "${cidrhost(element(var.cdn_ipnets["s1_public"], count.index), var.public_offsets["gw1"])}"
  16. }
  17. }
  18.  
  19. resource "openstack_networking_port_v2" "rtr_s1_public_port" {
  20. name = "gw1.${var.cdn_name}s1.public-${var.user_name}"
  21. network_id = "${openstack_networking_network_v2.s1_public.id}"
  22. admin_state_up = "true"
  23.  
  24. depends_on = [ "data.null_data_source.s1_public_gw_ips" ]
  25.  
  26. fixed_ip = [ "${data.null_data_source.s1_public_gw_ips.*.inputs}" ]
  27. }
  28.  
  29. Error: openstack_networking_port_v2.rtr_s1_public_port: "fixed_ip.0.subnet_id": required field is not set
  30.  
  31. > data.null_data_source.s1_public_gw_ips.*.inputs
  32. [
  33. { ip_address = 172.25.123.1 subnet_id = cab2bffa-d0f0-42fa-bc06-6e03f9a8dd67},
  34. { ip_address = 2a00:81c0:6001:141::1 subnet_id = 455444dc-7211-4a6a-a610-9fe480ff9ebc}
  35. ]
  36. > keys(data.null_data_source.s1_public_gw_ips.*.inputs[0])
  37. [
  38. ip_address,
  39. subnet_id
  40. ]
  41. > lookup(data.null_data_source.s1_public_gw_ips.*.inputs[0], "subnet_id")
  42. cab2bffa-d0f0-42fa-bc06-6e03f9a8dd67
Add Comment
Please, Sign In to add comment