|
| 1 | +resource "aci_rest" "cloudALB" { |
| 2 | + path = "/api/node/mo/${join("", regex("(uni/tn-.*?)/", var.epg_dn))}/clb-${var.name}.json" |
| 3 | + payload = <<EOF |
| 4 | + cloudLB: |
| 5 | + attributes: |
| 6 | + scheme: internet |
| 7 | + type: application |
| 8 | + children: |
| 9 | + - cloudRsLDevToCloudSubnet: |
| 10 | + attributes: |
| 11 | + tDn: ${var.subnet_a_dn} |
| 12 | + - cloudRsLDevToCloudSubnet: |
| 13 | + attributes: |
| 14 | + tDn: ${var.subnet_b_dn} |
| 15 | + EOF |
| 16 | +} |
| 17 | + |
| 18 | +resource "aci_rest" "serviceGraphCreate" { |
| 19 | + path = "/api/node/mo/${join("", regex("(uni/tn-.*?)/", var.epg_dn))}/AbsGraph-${var.name}.json" |
| 20 | + depends_on = [aci_rest.cloudALB] |
| 21 | + payload = <<EOF |
| 22 | + vnsAbsGraph: |
| 23 | + attributes: |
| 24 | + name: ${var.name} |
| 25 | + type: cloud |
| 26 | + children: |
| 27 | + - vnsAbsTermNodeProv: |
| 28 | + attributes: |
| 29 | + name: T2 |
| 30 | + children: |
| 31 | + - vnsAbsTermConn: |
| 32 | + attributes: |
| 33 | + name: ProvTermConn |
| 34 | + - vnsAbsTermNodeCon: |
| 35 | + attributes: |
| 36 | + name: T1 |
| 37 | + children: |
| 38 | + - vnsAbsTermConn: |
| 39 | + attributes: |
| 40 | + name: ConsTermConn |
| 41 | + - vnsAbsNode: |
| 42 | + attributes: |
| 43 | + name: N0 |
| 44 | + managed: "yes" |
| 45 | + funcType: GoTo |
| 46 | + funcTemplateType: ADC_ONE_ARM |
| 47 | + children: |
| 48 | + - vnsRsNodeToCloudLDev: |
| 49 | + attributes: |
| 50 | + tDn: ${join("", regex("(uni/tn-.*?)/", var.epg_dn))}/clb-${var.name} |
| 51 | + - vnsAbsFuncConn: |
| 52 | + attributes: |
| 53 | + name: provider |
| 54 | + attNotify: "no" |
| 55 | + connType: none |
| 56 | + - vnsAbsFuncConn: |
| 57 | + attributes: |
| 58 | + name: consumer |
| 59 | + attNotify: "no" |
| 60 | + connType: none |
| 61 | + - vnsAbsConnection: |
| 62 | + attributes: |
| 63 | + connDir: provider |
| 64 | + connType: external |
| 65 | + name: CON1 |
| 66 | + adjType: L3 |
| 67 | + children: |
| 68 | + - vnsRsAbsConnectionConns: |
| 69 | + attributes: |
| 70 | + tDn: ${join("", regex("(uni/tn-.*?)/", var.epg_dn))}/AbsGraph-${var.name}/AbsNode-N0/AbsFConn-provider |
| 71 | + - vnsRsAbsConnectionConns: |
| 72 | + attributes: |
| 73 | + tDn: ${join("", regex("(uni/tn-.*?)/", var.epg_dn))}/AbsGraph-${var.name}/AbsTermNodeProv-T2/AbsTConn |
| 74 | + - vnsAbsConnection: |
| 75 | + attributes: |
| 76 | + connDir: provider |
| 77 | + connType: external |
| 78 | + name: CON0 |
| 79 | + children: |
| 80 | + - vnsRsAbsConnectionConns: |
| 81 | + attributes: |
| 82 | + tDn: ${join("", regex("(uni/tn-.*?)/", var.epg_dn))}/AbsGraph-${var.name}/AbsNode-N0/AbsFConn-consumer |
| 83 | + - vnsRsAbsConnectionConns: |
| 84 | + attributes: |
| 85 | + tDn: ${join("", regex("(uni/tn-.*?)/", var.epg_dn))}/AbsGraph-${var.name}/AbsTermNodeCon-T1/AbsTConn |
| 86 | + EOF |
| 87 | +} |
| 88 | + |
| 89 | +resource "aci_rest" "appliedServiceGraph" { |
| 90 | + path = "/api/node/mo/${join("", regex("(uni/tn-.*?)/", var.epg_dn))}.json" |
| 91 | + depends_on = [aci_rest.serviceGraphCreate] |
| 92 | + payload = <<EOF |
| 93 | + fvTenant: |
| 94 | + attributes: |
| 95 | + name: ${join("", regex("/tn-(.*?)/", var.epg_dn))} |
| 96 | + children: |
| 97 | + - vnsAbsGraph: |
| 98 | + attributes: |
| 99 | + name: ${var.name} |
| 100 | + children: |
| 101 | + - vnsAbsNode: |
| 102 | + attributes: |
| 103 | + name: N0 |
| 104 | + children: |
| 105 | + - cloudSvcPolicy: |
| 106 | + attributes: |
| 107 | + contractName: ${join("", regex("/brc-(.*?)/", var.contract_subject_dn))} |
| 108 | + subjectName: ${join("", regex("/subj-(.*)", var.contract_subject_dn))} |
| 109 | + tenantName: ${join("", regex("/tn-(.*?)/", var.epg_dn))} |
| 110 | + children: |
| 111 | + - cloudListener: |
| 112 | + attributes: |
| 113 | + name: http_listener |
| 114 | + port: "${var.listenerPort}" |
| 115 | + protocol: http |
| 116 | + children: |
| 117 | + - cloudListenerRule: |
| 118 | + attributes: |
| 119 | + default: "yes" |
| 120 | + name: forward |
| 121 | + priority: "999" |
| 122 | + children: |
| 123 | + - cloudRuleAction: |
| 124 | + attributes: |
| 125 | + epgdn: ${var.epg_dn} |
| 126 | + port: "${var.hostPort}" |
| 127 | + protocol: http |
| 128 | + type: forward |
| 129 | + - vzBrCP: |
| 130 | + attributes: |
| 131 | + name: ${join("", regex("/brc-(.*?)/", var.contract_subject_dn))} |
| 132 | + children: |
| 133 | + - vzSubj: |
| 134 | + attributes: |
| 135 | + name: ${join("", regex("/subj-(.*)", var.contract_subject_dn))} |
| 136 | + children: |
| 137 | + - vzRsSubjGraphAtt: |
| 138 | + attributes: |
| 139 | + tnVnsAbsGraphName: ${var.name} |
| 140 | + EOF |
| 141 | +} |
| 142 | + |
| 143 | +output "dnsname" { |
| 144 | + value = data.aws_lb.wwwalb.dns_name |
| 145 | +} |
0 commit comments