Skip to content

Commit f9a11c1

Browse files
anvitha-jainlhercot
authored andcommitted
Changed url link in readme, made changes to resource_rest to allow parallel execution
1 parent 5c997a1 commit f9a11c1

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ $ make build
2525
```
2626

2727
Using The Provider
28+
<!-- https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin -->
2829
------------------
29-
If you are building the provider, follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin) After placing it into your plugins directory, run `terraform init` to initialize it.
30+
If you are building the provider, follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/cli/plugins/index.html) After placing it into your plugins directory, run `terraform init` to initialize it.
3031

3132
ex.
3233
```hcl

aci/resource_rest.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import (
1515
const Created = "created"
1616
const Deleted = "deleted"
1717

18-
var class string
19-
2018
const ErrDistinguishedNameNotFound = "The Dn is not present in the content"
2119

2220
func resourceAciRest() *schema.Resource {
@@ -64,7 +62,7 @@ func resourceAciRestCreate(d *schema.ResourceData, m interface{}) error {
6462
className := classNameIntf.(string)
6563
dn := models.StripQuotes(models.StripSquareBrackets(cont.Search(className, "attributes", "dn").String()))
6664
if dn == "{}" {
67-
d.SetId(GetDN(d, m))
65+
d.SetId(GetDN(d, m, className))
6866
} else {
6967
d.SetId(dn)
7068
}
@@ -81,7 +79,7 @@ func resourceAciRestUpdate(d *schema.ResourceData, m interface{}) error {
8179
className := classNameIntf.(string)
8280
dn := models.StripQuotes(models.StripSquareBrackets(cont.Search(className, "attributes", "dn").String()))
8381
if dn == "{}" {
84-
d.SetId(GetDN(d, m))
82+
d.SetId(GetDN(d, m, className))
8583
} else {
8684
d.SetId(dn)
8785
}
@@ -106,11 +104,11 @@ func resourceAciRestDelete(d *schema.ResourceData, m interface{}) error {
106104
return nil
107105
}
108106

109-
func GetDN(d *schema.ResourceData, m interface{}) string {
107+
func GetDN(d *schema.ResourceData, m interface{}, className string) string {
110108
aciClient := m.(*client.Client)
111109
path := d.Get("path").(string)
112110
cont, _ := aciClient.GetViaURL(path)
113-
dn := models.StripQuotes(models.StripSquareBrackets(cont.Search("imdata", class, "attributes", "dn").String()))
111+
dn := models.StripQuotes(models.StripSquareBrackets(cont.Search("imdata", className, "attributes", "dn").String()))
114112
return fmt.Sprintf("%s", dn)
115113
}
116114

@@ -169,6 +167,7 @@ func PostAndSetStatus(d *schema.ResourceData, m interface{}, status string) (*co
169167
if err_output != nil {
170168
return nil, err_output
171169
}
170+
var class string
172171
for key, _ := range output {
173172
class = key
174173
}

examples/epg/contract.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resource "aci_contract" "rs_prov_contract" {
1010
scope = "context"
1111
target_dscp = "VA"
1212
prio = "unspecified"
13-
relation_vz_rs_graph_att = "test3" # Relation to vnsAbsGraph class. Cardinality - N_TO_ONE
13+
relation_vz_rs_graph_att = aci_rest.rest_abs_graph.id # Relation to vnsAbsGraph class. Cardinality - N_TO_ONE
1414
}
1515
resource "aci_contract" "rs_cons_contract" {
1616
tenant_dn = aci_tenant.tenant_for_contract.id
@@ -19,7 +19,7 @@ resource "aci_contract" "rs_cons_contract" {
1919
scope = "context"
2020
target_dscp = "VA"
2121
prio = "unspecified"
22-
relation_vz_rs_graph_att = "test3" # Relation to vnsAbsGraph class. Cardinality - N_TO_ONE
22+
relation_vz_rs_graph_att = aci_rest.rest_abs_graph.id # Relation to vnsAbsGraph class. Cardinality - N_TO_ONE
2323
}
2424
resource "aci_contract" "intra_epg_contract" {
2525
tenant_dn = aci_tenant.tenant_for_contract.id
@@ -28,5 +28,5 @@ resource "aci_contract" "intra_epg_contract" {
2828
scope = "context"
2929
target_dscp = "VA"
3030
prio = "unspecified"
31-
relation_vz_rs_graph_att = "test3" # Relation to vnsAbsGraph class. Cardinality - N_TO_ONE
31+
relation_vz_rs_graph_att = aci_rest.rest_abs_graph.id # Relation to vnsAbsGraph class. Cardinality - N_TO_ONE
3232
}

examples/epg/epg.tf

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,26 @@ resource "aci_application_epg" "demoepg" {
2222
description = "This epg is created by terraform ACI providers"
2323
flood_on_encap = "disabled"
2424
fwd_ctrl = "none"
25-
is_attr_based_epg = "no"
25+
is_attr_based_epg = "no"
2626
match_t = "None"
2727
pc_enf_pref = "unenforced"
2828
pref_gr_memb = "exclude"
2929
prio = "unspecified"
3030
relation_fv_rs_bd = aci_bridge_domain.bd_for_rel.id # Relation to fvBD class. Cardinality - N_TO_ONE.
3131
relation_fv_rs_cust_qos_pol = aci_rest.rest_qos_custom_pol.id # Relation to qosCustomPol class. Cardinality - N_TO_ONE.
32-
relation_fv_rs_dom_att = [aci_rest.rest_infra_domp.id] # Relation to infraDomP class. Cardinality - N_TO_M.
33-
relation_fv_rs_fc_path_att = ["testfabric"] # Relation to fabricPathEp class. Cardinality - N_TO_M.
32+
33+
// remove// relation_fv_rs_dom_att = [aci_rest.rest_infra_domp.id] # Relation to infraDomP class. Cardinality - N_TO_M.
34+
// relation_fv_rs_fc_path_att = ["testfabric"] # Relation to fabricPathEp class. Cardinality - N_TO_M.
35+
3436
relation_fv_rs_prov = [aci_contract.rs_prov_contract.id] # Relation to vzBrCP class. Cardinality - N_TO_M.
35-
relation_fv_rs_cons_if = [aci_rest.rest_vz_cons_if.id] # Relation to vzCPIf class. Cardinality - N_TO_M.
37+
38+
// relation_fv_rs_cons_if = [aci_rest.rest_vz_cons_if.id] # Relation to vzCPIf class. Cardinality - N_TO_M.
3639
relation_fv_rs_sec_inherited = [aci_application_epg.inherit_epg.id] # Relation to fvEPg class. Cardinality - N_TO_M.
37-
relation_fv_rs_node_att = ["testnodeatt"] # Relation to fabricNode class. Cardinality - N_TO_M.
38-
relation_fv_rs_dpp_pol = aci_rest.rest_qos_dpp_pol.id # Relation to qosDppPol class. Cardinality - N_TO_ONE.
40+
// relation_fv_rs_node_att = ["testnodeatt"] # Relation to fabricNode class. Cardinality - N_TO_M.
41+
// relation_fv_rs_dpp_pol = aci_rest.rest_qos_dpp_pol.id # Relation to qosDppPol class. Cardinality - N_TO_ONE.ye
3942
relation_fv_rs_cons = [aci_contract.rs_cons_contract.id] # Relation to vzBrCP class. Cardinality - N_TO_M.
40-
relation_fv_rs_trust_ctrl = aci_rest.rest_trust_ctrl_pol.id # Relation to fhsTrustCtrlPol class. Cardinality - N_TO_ONE.
41-
relation_fv_rs_prot_by = [aci_rest.rest_taboo_con.id] # Relation to vzTaboo class. Cardinality - N_TO_M.
42-
relation_fv_rs_aepg_mon_pol = aci_rest.rest_mon_epg_pol.id # Relation to monEPGPol class. Cardinality - N_TO_ONE.
43+
// relation_fv_rs_trust_ctrl = aci_rest.rest_trust_ctrl_pol.id # Relation to fhsTrustCtrlPol class. Cardinality - N_TO_ONE.
44+
// relation_fv_rs_prot_by = [aci_rest.rest_taboo_con.id] # Relation to vzTaboo class. Cardinality - N_TO_M.
45+
// relation_fv_rs_aepg_mon_pol = aci_rest.rest_mon_epg_pol.id # Relation to monEPGPol class. Cardinality - N_TO_ONE.
4346
relation_fv_rs_intra_epg = [aci_contract.intra_epg_contract.id] # Relation to vzBrCP class. Cardinality - N_TO_M.
4447
}

examples/epg/rest.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ resource "aci_rest" "rest_qos_custom_pol" {
77
}
88
}
99

10-
1110
resource "aci_rest" "rest_infra_domp" {
1211
path = "api/node/mo/uni/fc-test.json"
1312
class_name = "fcDomP"
@@ -57,3 +56,12 @@ resource "aci_rest" "rest_taboo_con" {
5756
"name" = "testcon"
5857
}
5958
}
59+
60+
resource "aci_rest" "rest_abs_graph" {
61+
path = "api/node/mo/${aci_tenant.tenant_for_contract.id}/AbsGraph-testgraph.json"
62+
class_name = "vnsAbsGraph"
63+
64+
content = {
65+
"name" = "testgraph"
66+
}
67+
}

0 commit comments

Comments
 (0)