Skip to content

Commit cfe6602

Browse files
anvitha-jainlhercot
authored andcommitted
Added contract filter entry changes
1 parent a4b71e9 commit cfe6602

File tree

15 files changed

+82
-137
lines changed

15 files changed

+82
-137
lines changed

examples/aci_test/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ resource "aci_contract" "contract_epg1_epg2" {
7373
resource "aci_contract_subject" "Web_subject1" {
7474
contract_dn = aci_contract.contract_epg1_epg2.id
7575
name = "Subject"
76-
relation_vz_rs_subj_filt_att = [aci_filter.allow_https.name, aci_filter.allow_icmp.name]
76+
relation_vz_rs_subj_filt_att = [aci_filter.allow_https.id, aci_filter.allow_icmp.id]
7777
}
7878

7979
resource "aci_filter" "allow_https" {

examples/aci_vmm/aci_resources/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ resource "aci_contract" "contract_epg1_epg2" {
6868
resource "aci_contract_subject" "Web_subject1" {
6969
contract_dn = aci_contract.contract_epg1_epg2.id
7070
name = "Subject"
71-
relation_vz_rs_subj_filt_att = [aci_filter.allow_https.name,aci_filter.allow_icmp.name]
71+
relation_vz_rs_subj_filt_att = [aci_filter.allow_https.id,aci_filter.allow_icmp.id]
7272
}
7373

7474
resource "aci_filter" "allow_https" {

examples/cloud_apic/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ resource "aci_contract" "contract_epg1_epg2" {
5353
resource "aci_contract_subject" "Web_subject1" {
5454
contract_dn = aci_contract.contract_epg1_epg2.id
5555
name = "Subject"
56-
relation_vz_rs_subj_filt_att = [aci_filter.allow_https.name, aci_filter.allow_icmp.name]
56+
relation_vz_rs_subj_filt_att = [aci_filter.allow_https.id, aci_filter.allow_icmp.id]
5757
}
5858

5959
resource "aci_filter" "allow_https" {

examples/contract/contract.tf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,25 @@ resource "aci_tenant" "tenant_for_contract" {
33
description = "This tenant is created by terraform ACI provider"
44
}
55

6-
resource "aci_contract" "democontract" {
6+
resource "aci_l4_l7_service_graph_template" "rest_abs_graph" {
7+
tenant_dn = aci_tenant.tenant_for_contract.id
8+
name = "testgraph"
9+
}
10+
11+
// Creating a contract
12+
resource "aci_contract" "web_contract" {
713
tenant_dn = aci_tenant.tenant_for_contract.id
814
name = "test_tf_contract"
915
description = "This contract is created by terraform ACI provider"
1016
scope = "context"
1117
target_dscp = "VA"
1218
prio = "unspecified"
13-
relation_vz_rs_graph_att = aci_rest.rest_abs_graph.id # Relation to vnsAbsGraph class. Cardinality - N_TO_ONE
1419
}
20+
21+
// Creating contract subject to connect contract to filters and filter entries in filter.tf file
22+
resource "aci_contract_subject" "web_subject" {
23+
contract_dn = aci_contract.web_contract.id
24+
name = "Subject"
25+
relation_vz_rs_subj_graph_att = aci_l4_l7_service_graph_template.rest_abs_graph.id
26+
relation_vz_rs_subj_filt_att = [aci_filter.allow_https.id,aci_filter.allow_icmp.id]
27+
}

examples/contract/filter.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Add below filter and filter entries to contract web_contract in contract.tf file
2+
3+
resource "aci_filter" "allow_https" {
4+
tenant_dn = aci_tenant.tenant_for_contract.id
5+
name = "allow_https"
6+
}
7+
resource "aci_filter" "allow_icmp" {
8+
tenant_dn = aci_tenant.tenant_for_contract.id
9+
name = "allow_icmp"
10+
}
11+
12+
resource "aci_filter_entry" "https" {
13+
name = "https"
14+
filter_dn = aci_filter.allow_https.id
15+
ether_t = "ip"
16+
prot = "tcp"
17+
d_from_port = "https"
18+
d_to_port = "https"
19+
stateful = "yes"
20+
}
21+
22+
resource "aci_filter_entry" "icmp" {
23+
name = "icmp"
24+
filter_dn = aci_filter.allow_icmp.id
25+
ether_t = "ip"
26+
prot = "icmp"
27+
stateful = "yes"
28+
}

examples/contract/main.tf

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,8 @@ terraform {
77
}
88

99
provider "aci" {
10-
username = ""
11-
password = ""
12-
url = ""
10+
username = "" # <APIC username>
11+
password = "" # <APIC pwd>
12+
url = "" # <cloud APIC URL>
1313
insecure = true
1414
}
15-
16-
# provider "aci" {
17-
# username = ""
18-
# private_key = ""
19-
# cert_name = ""
20-
# url = ""
21-
# insecure = true
22-
# }
23-

examples/contract/rest.tf

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/epg/contract.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,15 @@ resource "aci_contract" "intra_epg_contract" {
3737
prio = "unspecified"
3838
relation_vz_rs_graph_att = aci_l4_l7_service_graph_template.rest_abs_graph.id
3939
}
40+
41+
// Taboo Contract
42+
resource "aci_taboo_contract" "rest_taboo_con" {
43+
tenant_dn = aci_tenant.tenant_for_epg.id
44+
name = "testcon"
45+
}
46+
47+
// Imported Contract
48+
resource "aci_imported_contract" "rest_vz_cons_if" {
49+
tenant_dn = aci_tenant.tenant_for_epg.id
50+
name = "testcontract"
51+
}

examples/epg/epg.tf

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ resource "aci_application_epg" "inherit_epg" {
1616

1717
}
1818

19+
// Creation of Monitoring policy
20+
resource "aci_monitoring_policy" "rest_mon_epg_pol" {
21+
tenant_dn = aci_tenant.tenant_for_epg.id
22+
name = "testpol"
23+
}
24+
1925
resource "aci_application_epg" "demoepg" {
2026
application_profile_dn = aci_application_profile.app_profile_for_epg.id
2127
name = "tf_test_epg"
@@ -27,15 +33,15 @@ resource "aci_application_epg" "demoepg" {
2733
pc_enf_pref = "unenforced"
2834
pref_gr_memb = "exclude"
2935
prio = "unspecified"
30-
relation_fv_rs_bd = aci_bridge_domain.bd_for_rel.id # Relation to fvBD class. Cardinality - N_TO_ONE.
31-
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_prov = [aci_contract.rs_prov_contract.id] # Relation to vzBrCP class. Cardinality - N_TO_M.
33-
relation_fv_rs_cons_if = [aci_rest.rest_vz_cons_if.id] # Relation to vzCPIf class. Cardinality - N_TO_M.
34-
relation_fv_rs_sec_inherited = [aci_application_epg.inherit_epg.id] # Relation to fvEPg class. Cardinality - N_TO_M.
35-
relation_fv_rs_dpp_pol = aci_rest.rest_qos_dpp_pol.id # Relation to qosDppPol class. Cardinality - N_TO_ONE.ye
36-
relation_fv_rs_cons = [aci_contract.rs_cons_contract.id] # Relation to vzBrCP class. Cardinality - N_TO_M.
37-
relation_fv_rs_trust_ctrl = aci_rest.rest_trust_ctrl_pol.id # Relation to fhsTrustCtrlPol class. Cardinality - N_TO_ONE.
38-
relation_fv_rs_prot_by = [aci_rest.rest_taboo_con.id] # Relation to vzTaboo class. Cardinality - N_TO_M.
39-
relation_fv_rs_aepg_mon_pol = aci_rest.rest_mon_epg_pol.id # Relation to monEPGPol class. Cardinality - N_TO_ONE.
40-
relation_fv_rs_intra_epg = [aci_contract.intra_epg_contract.id] # Relation to vzBrCP class. Cardinality - N_TO_M.
36+
relation_fv_rs_bd = aci_bridge_domain.bd_for_rel.id # Relation to Bridge Domain
37+
relation_fv_rs_cust_qos_pol = aci_rest.rest_qos_custom_pol.id # Relation to Custom Quality of Service - QoS traffic policy
38+
relation_fv_rs_prov = [aci_contract.rs_prov_contract.id] # Relation to Provided Contract
39+
relation_fv_rs_cons_if = [aci_imported_contract.rest_vz_cons_if.id] # Relation to Imported Contract
40+
relation_fv_rs_sec_inherited = [aci_application_epg.inherit_epg.id] # Relation to inherit security configuration from another EPG
41+
relation_fv_rs_dpp_pol = aci_rest.rest_qos_dpp_pol.id # Relation to Data Plane Policing
42+
relation_fv_rs_cons = [aci_contract.rs_cons_contract.id] # Relation to Consumed Contract
43+
relation_fv_rs_trust_ctrl = aci_rest.rest_trust_ctrl_pol.id # Relation to First Hop Security trust control
44+
relation_fv_rs_prot_by = [aci_taboo_contract.rest_taboo_con.id] # Relation to vzTaboo Taboo Contract
45+
relation_fv_rs_aepg_mon_pol = aci_monitoring_policy.rest_mon_epg_pol.id # Relation to Monitoring policy
46+
relation_fv_rs_intra_epg = [aci_contract.intra_epg_contract.id] # Relation to Intra EPG Contract
4147
}

examples/epg/main.tf

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,3 @@ provider "aci" {
1212
url = "" # <cloud APIC URL>
1313
insecure = true
1414
}
15-
16-
# provider "aci" {
17-
# username = ""
18-
# private_key = ""
19-
# cert_name = ""
20-
# url = ""
21-
# insecure = true
22-
# }
23-

0 commit comments

Comments
 (0)