Skip to content

Commit

Permalink
Merge pull request #137 from citrix/new_resources
Browse files Browse the repository at this point in the history
New resources
  • Loading branch information
George Nikolopoulos authored Feb 22, 2021
2 parents 8e6779a + d665753 commit b050ac9
Show file tree
Hide file tree
Showing 13 changed files with 1,370 additions and 111 deletions.
170 changes: 86 additions & 84 deletions citrixadc/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,90 +78,92 @@ func providerSchema() map[string]*schema.Schema {

func providerResources() map[string]*schema.Resource {
return map[string]*schema.Resource{
"citrixadc_lbvserver": resourceCitrixAdcLbvserver(),
"citrixadc_service": resourceCitrixAdcService(),
"citrixadc_csvserver": resourceCitrixAdcCsvserver(),
"citrixadc_cspolicy": resourceCitrixAdcCspolicy(),
"citrixadc_csaction": resourceCitrixAdcCsaction(),
"citrixadc_sslaction": resourceCitrixAdcSslaction(),
"citrixadc_sslpolicy": resourceCitrixAdcSslpolicy(),
"citrixadc_sslcertkey": resourceCitrixAdcSslcertkey(),
"citrixadc_sslprofile": resourceCitrixAdcSslprofile(),
"citrixadc_sslparameter": resourceCitrixAdcSslparameter(),
"citrixadc_ssldhparam": resourceCitrixAdcSsldhparam(),
"citrixadc_sslcipher": resourceCitrixAdcSslcipher(),
"citrixadc_lbmonitor": resourceCitrixAdcLbmonitor(),
"citrixadc_servicegroup": resourceCitrixAdcServicegroup(),
"citrixadc_nsacl": resourceCitrixAdcNsacl(),
"citrixadc_nsacls": resourceCitrixAdcNsacls(),
"citrixadc_inat": resourceCitrixAdcInat(),
"citrixadc_rnat": resourceCitrixAdcRnats(),
"citrixadc_gslbsite": resourceCitrixAdcGslbsite(),
"citrixadc_gslbvserver": resourceCitrixAdcGslbvserver(),
"citrixadc_gslbservice": resourceCitrixAdcGslbservice(),
"citrixadc_server": resourceCitrixAdcServer(),
"citrixadc_responderaction": resourceCitrixAdcResponderaction(),
"citrixadc_responderpolicy": resourceCitrixAdcResponderpolicy(),
"citrixadc_responderpolicylabel": resourceCitrixAdcResponderpolicylabel(),
"citrixadc_rewriteaction": resourceCitrixAdcRewriteaction(),
"citrixadc_rewritepolicy": resourceCitrixAdcRewritepolicy(),
"citrixadc_rewritepolicylabel": resourceCitrixAdcRewritepolicylabel(),
"citrixadc_nsip": resourceCitrixAdcNsip(),
"citrixadc_nsip6": resourceCitrixAdcNsip6(),
"citrixadc_nsconfig_save": resourceCitrixAdcNsconfigSave(),
"citrixadc_nsconfig_clear": resourceCitrixAdcNsconfigClear(),
"citrixadc_nsconfig_update": resourceCitrixAdcNsconfigUpdate(),
"citrixadc_ipset": resourceCitrixAdcIpset(),
"citrixadc_route": resourceCitrixAdcRoute(),
"citrixadc_linkset": resourceCitrixAdcLinkset(),
"citrixadc_nsfeature": resourceCitrixAdcNsfeature(),
"citrixadc_systemuser": resourceCitrixAdcSystemuser(),
"citrixadc_systemgroup": resourceCitrixAdcSystemgroup(),
"citrixadc_systemcmdpolicy": resourceCitrixAdcSystemcmdpolicy(),
"citrixadc_interface": resourceCitrixAdcInterface(),
"citrixadc_nstcpprofile": resourceCitrixAdcNstcpprofile(),
"citrixadc_nshttpprofile": resourceCitrixAdcNshttpprofile(),
"citrixadc_nslicense": resourceCitrixAdcNslicense(),
"citrixadc_cluster": resourceCitrixAdcCluster(),
"citrixadc_clusterfiles_syncer": resourceCitrixAdcClusterfilesSyncer(),
"citrixadc_systemfile": resourceCitrixAdcSystemfile(),
"citrixadc_auditmessageaction": resourceCitrixAdcAuditmessageaction(),
"citrixadc_auditsyslogaction": resourceCitrixAdcAuditsyslogaction(),
"citrixadc_auditsyslogpolicy": resourceCitrixAdcAuditsyslogpolicy(),
"citrixadc_rebooter": resourceCitrixAdcRebooter(),
"citrixadc_installer": resourceCitrixAdcInstaller(),
"citrixadc_pinger": resourceCitrixAdcPinger(),
"citrixadc_nsrpcnode": resourceCitrixAdcNsrpcnode(),
"citrixadc_routerdynamicrouting": resourceCitrixAdcRouterdynamicrouting(),
"citrixadc_policyexpression": resourceCitrixAdcPolicyexpression(),
"citrixadc_systemextramgmtcpu": resourceCitrixAdcSystemextramgmtcpu(),
"citrixadc_netprofile": resourceCitrixAdcNetprofile(),
"citrixadc_servicegroup_lbmonitor_binding": resourceCitrixAdcServicegroup_lbmonitor_binding(),
"citrixadc_nsparam": resourceCitrixAdcNsparam(),
"citrixadc_sslvserver_sslpolicy_binding": resourceCitrixAdcSslvserver_sslpolicy_binding(),
"citrixadc_sslprofile_sslcipher_binding": resourceCitrixAdcSslprofile_sslcipher_binding(),
"citrixadc_policydataset": resourceCitrixAdcPolicydataset(),
"citrixadc_policydataset_value_binding": resourceCitrixAdcPolicydataset_value_binding(),
"citrixadc_password_resetter": resourceCitrixAdcPasswordResetter(),
"citrixadc_csvserver_cspolicy_binding": resourceCitrixAdcCsvserver_cspolicy_binding(),
"citrixadc_appfwprofile": resourceCitrixAdcAppfwprofile(),
"citrixadc_appfwpolicy": resourceCitrixAdcAppfwpolicy(),
"citrixadc_appfwfieldtype": resourceCitrixAdcAppfwfieldtype(),
"citrixadc_appfwpolicylabel": resourceCitrixAdcAppfwpolicylabel(),
"citrixadc_appfwjsoncontenttype": resourceCitrixAdcAppfwjsoncontenttype(),
"citrixadc_appfwxmlcontenttype": resourceCitrixAdcAppfwxmlcontenttype(),
"citrixadc_appfwprofile_starturl_binding": resourceCitrixAdcAppfwprofileStarturlBinding(),
"citrixadc_appfwprofile_denyurl_binding": resourceCitrixAdcAppfwprofileDenyurlBinding(),
"citrixadc_nslicenseserver": resourceCitrixAdcNslicenseserver(),
"citrixadc_nscapacity": resourceCitrixAdcNscapacity(),
"citrixadc_lbvserver_service_binding": resourceCitrixAdcLbvserver_service_binding(),
"citrixadc_policystringmap": resourceCitrixAdcPolicystringmap(),
"citrixadc_policystringmap_pattern_binding": resourceCitrixAdcPolicystringmap_pattern_binding(),
"citrixadc_transformprofile": resourceCitrixAdcTransformprofile(),
"citrixadc_transformaction": resourceCitrixAdcTransformaction(),
"citrixadc_transformpolicy": resourceCitrixAdcTransformpolicy(),
"citrixadc_lbvserver_transformpolicy_binding": resourceCitrixAdcLbvserver_transformpolicy_binding(),
"citrixadc_csvserver_transformpolicy_binding": resourceCitrixAdcCsvserver_transformpolicy_binding(),
"citrixadc_lbvserver": resourceCitrixAdcLbvserver(),
"citrixadc_service": resourceCitrixAdcService(),
"citrixadc_csvserver": resourceCitrixAdcCsvserver(),
"citrixadc_cspolicy": resourceCitrixAdcCspolicy(),
"citrixadc_csaction": resourceCitrixAdcCsaction(),
"citrixadc_sslaction": resourceCitrixAdcSslaction(),
"citrixadc_sslpolicy": resourceCitrixAdcSslpolicy(),
"citrixadc_sslcertkey": resourceCitrixAdcSslcertkey(),
"citrixadc_sslprofile": resourceCitrixAdcSslprofile(),
"citrixadc_sslparameter": resourceCitrixAdcSslparameter(),
"citrixadc_ssldhparam": resourceCitrixAdcSsldhparam(),
"citrixadc_sslcipher": resourceCitrixAdcSslcipher(),
"citrixadc_lbmonitor": resourceCitrixAdcLbmonitor(),
"citrixadc_servicegroup": resourceCitrixAdcServicegroup(),
"citrixadc_nsacl": resourceCitrixAdcNsacl(),
"citrixadc_nsacls": resourceCitrixAdcNsacls(),
"citrixadc_inat": resourceCitrixAdcInat(),
"citrixadc_rnat": resourceCitrixAdcRnats(),
"citrixadc_gslbsite": resourceCitrixAdcGslbsite(),
"citrixadc_gslbvserver": resourceCitrixAdcGslbvserver(),
"citrixadc_gslbservice": resourceCitrixAdcGslbservice(),
"citrixadc_server": resourceCitrixAdcServer(),
"citrixadc_responderaction": resourceCitrixAdcResponderaction(),
"citrixadc_responderpolicy": resourceCitrixAdcResponderpolicy(),
"citrixadc_responderpolicylabel": resourceCitrixAdcResponderpolicylabel(),
"citrixadc_rewriteaction": resourceCitrixAdcRewriteaction(),
"citrixadc_rewritepolicy": resourceCitrixAdcRewritepolicy(),
"citrixadc_rewritepolicylabel": resourceCitrixAdcRewritepolicylabel(),
"citrixadc_nsip": resourceCitrixAdcNsip(),
"citrixadc_nsip6": resourceCitrixAdcNsip6(),
"citrixadc_nsconfig_save": resourceCitrixAdcNsconfigSave(),
"citrixadc_nsconfig_clear": resourceCitrixAdcNsconfigClear(),
"citrixadc_nsconfig_update": resourceCitrixAdcNsconfigUpdate(),
"citrixadc_ipset": resourceCitrixAdcIpset(),
"citrixadc_route": resourceCitrixAdcRoute(),
"citrixadc_linkset": resourceCitrixAdcLinkset(),
"citrixadc_nsfeature": resourceCitrixAdcNsfeature(),
"citrixadc_systemuser": resourceCitrixAdcSystemuser(),
"citrixadc_systemgroup": resourceCitrixAdcSystemgroup(),
"citrixadc_systemcmdpolicy": resourceCitrixAdcSystemcmdpolicy(),
"citrixadc_interface": resourceCitrixAdcInterface(),
"citrixadc_nstcpprofile": resourceCitrixAdcNstcpprofile(),
"citrixadc_nshttpprofile": resourceCitrixAdcNshttpprofile(),
"citrixadc_nslicense": resourceCitrixAdcNslicense(),
"citrixadc_cluster": resourceCitrixAdcCluster(),
"citrixadc_clusterfiles_syncer": resourceCitrixAdcClusterfilesSyncer(),
"citrixadc_systemfile": resourceCitrixAdcSystemfile(),
"citrixadc_auditmessageaction": resourceCitrixAdcAuditmessageaction(),
"citrixadc_auditsyslogaction": resourceCitrixAdcAuditsyslogaction(),
"citrixadc_auditsyslogpolicy": resourceCitrixAdcAuditsyslogpolicy(),
"citrixadc_rebooter": resourceCitrixAdcRebooter(),
"citrixadc_installer": resourceCitrixAdcInstaller(),
"citrixadc_pinger": resourceCitrixAdcPinger(),
"citrixadc_nsrpcnode": resourceCitrixAdcNsrpcnode(),
"citrixadc_routerdynamicrouting": resourceCitrixAdcRouterdynamicrouting(),
"citrixadc_policyexpression": resourceCitrixAdcPolicyexpression(),
"citrixadc_systemextramgmtcpu": resourceCitrixAdcSystemextramgmtcpu(),
"citrixadc_netprofile": resourceCitrixAdcNetprofile(),
"citrixadc_servicegroup_lbmonitor_binding": resourceCitrixAdcServicegroup_lbmonitor_binding(),
"citrixadc_nsparam": resourceCitrixAdcNsparam(),
"citrixadc_sslvserver_sslpolicy_binding": resourceCitrixAdcSslvserver_sslpolicy_binding(),
"citrixadc_sslprofile_sslcipher_binding": resourceCitrixAdcSslprofile_sslcipher_binding(),
"citrixadc_policydataset": resourceCitrixAdcPolicydataset(),
"citrixadc_policydataset_value_binding": resourceCitrixAdcPolicydataset_value_binding(),
"citrixadc_password_resetter": resourceCitrixAdcPasswordResetter(),
"citrixadc_csvserver_cspolicy_binding": resourceCitrixAdcCsvserver_cspolicy_binding(),
"citrixadc_appfwprofile": resourceCitrixAdcAppfwprofile(),
"citrixadc_appfwpolicy": resourceCitrixAdcAppfwpolicy(),
"citrixadc_appfwfieldtype": resourceCitrixAdcAppfwfieldtype(),
"citrixadc_appfwpolicylabel": resourceCitrixAdcAppfwpolicylabel(),
"citrixadc_appfwjsoncontenttype": resourceCitrixAdcAppfwjsoncontenttype(),
"citrixadc_appfwxmlcontenttype": resourceCitrixAdcAppfwxmlcontenttype(),
"citrixadc_appfwprofile_starturl_binding": resourceCitrixAdcAppfwprofileStarturlBinding(),
"citrixadc_appfwprofile_denyurl_binding": resourceCitrixAdcAppfwprofileDenyurlBinding(),
"citrixadc_nslicenseserver": resourceCitrixAdcNslicenseserver(),
"citrixadc_nscapacity": resourceCitrixAdcNscapacity(),
"citrixadc_lbvserver_service_binding": resourceCitrixAdcLbvserver_service_binding(),
"citrixadc_policystringmap": resourceCitrixAdcPolicystringmap(),
"citrixadc_policystringmap_pattern_binding": resourceCitrixAdcPolicystringmap_pattern_binding(),
"citrixadc_transformprofile": resourceCitrixAdcTransformprofile(),
"citrixadc_transformaction": resourceCitrixAdcTransformaction(),
"citrixadc_transformpolicy": resourceCitrixAdcTransformpolicy(),
"citrixadc_lbvserver_transformpolicy_binding": resourceCitrixAdcLbvserver_transformpolicy_binding(),
"citrixadc_csvserver_transformpolicy_binding": resourceCitrixAdcCsvserver_transformpolicy_binding(),
"citrixadc_sslvserver_sslcertkey_binding": resourceCitrixAdcSslvserver_sslcertkey_binding(),
"citrixadc_servicegroup_servicegroupmember_binding": resourceCitrixAdcServicegroup_servicegroupmember_binding(),
}
}

Expand Down
8 changes: 6 additions & 2 deletions citrixadc/resource_citrixadc_csvserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,12 @@ func readCsvserverFunc(d *schema.ResourceData, meta interface{}) error {
d.Set("ttl", data["ttl"])
d.Set("vipheader", data["vipheader"])

if err := readSslcerts(d, meta, csvserverName); err != nil {
return err
_, sslok := d.GetOk("sslcertkey")
_, sniok := d.GetOk("snisslcertkeys")
if sslok || sniok {
if err := readSslcerts(d, meta, csvserverName); err != nil {
return err
}
}

if err := readSslpolicyBindings(d, meta, csvserverName); err != nil {
Expand Down
8 changes: 6 additions & 2 deletions citrixadc/resource_citrixadc_lbvserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,12 @@ func readLbvserverFunc(d *schema.ResourceData, meta interface{}) error {
d.Set("vipheader", data["vipheader"])
d.Set("weight", data["weight"])

if err := readSslcerts(d, meta, lbvserverName); err != nil {
return err
_, sslok := d.GetOk("sslcertkey")
_, sniok := d.GetOk("snisslcertkeys")
if sslok || sniok {
if err := readSslcerts(d, meta, lbvserverName); err != nil {
return err
}
}

if err := readSslpolicyBindings(d, meta, lbvserverName); err != nil {
Expand Down
40 changes: 22 additions & 18 deletions citrixadc/resource_citrixadc_servicegroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,26 +658,30 @@ func readServicegroupFunc(d *schema.ResourceData, meta interface{}) error {
d.Set("usip", data["usip"])
d.Set("weight", data["weight"])

//boundMembers is of type []map[string]interface{}
servicegroupMembers := make([]string, 0, len(boundMembers))
servicegroupMembersByServername := make([]string, 0, len(boundMembers))
for _, member := range boundMembers {
ip := member["ip"].(string)
servername := member["servername"].(string)
port := member["port"].(float64) //TODO: why is this not int?
weight := member["weight"].(string)
// Heuristic rule
var strmember string
if servername == ip {
strmember = fmt.Sprintf("%s:%.0f:%s", ip, port, weight)
servicegroupMembers = append(servicegroupMembers, strmember)
} else {
strmember = fmt.Sprintf("%s:%.0f:%s", servername, port, weight)
servicegroupMembersByServername = append(servicegroupMembersByServername, strmember)
_, membersOk := d.GetOk("servicegroupmembers")
_, membersByNameOk := d.GetOk("servicegroupmembers_by_servername")
if membersOk || membersByNameOk {
//boundMembers is of type []map[string]interface{}
servicegroupMembers := make([]string, 0, len(boundMembers))
servicegroupMembersByServername := make([]string, 0, len(boundMembers))
for _, member := range boundMembers {
ip := member["ip"].(string)
servername := member["servername"].(string)
port := member["port"].(float64) //TODO: why is this not int?
weight := member["weight"].(string)
// Heuristic rule
var strmember string
if servername == ip {
strmember = fmt.Sprintf("%s:%.0f:%s", ip, port, weight)
servicegroupMembers = append(servicegroupMembers, strmember)
} else {
strmember = fmt.Sprintf("%s:%.0f:%s", servername, port, weight)
servicegroupMembersByServername = append(servicegroupMembersByServername, strmember)
}
}
d.Set("servicegroupmembers", servicegroupMembers)
d.Set("servicegroupmembers_by_servername", servicegroupMembersByServername)
}
d.Set("servicegroupmembers", servicegroupMembers)
d.Set("servicegroupmembers_by_servername", servicegroupMembersByServername)

//vserverBindings is of type []map[string]interface{}
var boundVserver string
Expand Down
Loading

0 comments on commit b050ac9

Please sign in to comment.