Skip to content

Commit

Permalink
Merge pull request #2 in VTMTF/terraform-provider-vtm-public from bug…
Browse files Browse the repository at this point in the history
…fix/VTMTF-91-terraform-import-fails-as-name-field-is-not-passed-to-obj-read to master

* commit 'ac4c69b1bcf2eb2126838d19167d1cf9a50ce57c':
  Fix for ISSUE_1 import failures
  • Loading branch information
Matthew Geldert committed Jul 4, 2018
2 parents f0a3922 + ac4c69b commit 72a06a8
Show file tree
Hide file tree
Showing 150 changed files with 819 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ func dataSourceAction() *schema.Resource {

func dataSourceActionRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetAction(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_action_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceActionProgram() *schema.Resource {

func dataSourceActionProgramRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetActionProgram(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_aptimizer_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func dataSourceAptimizerProfile() *schema.Resource {

func dataSourceAptimizerProfileRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetAptimizerProfile(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_aptimizer_scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func dataSourceAptimizerScope() *schema.Resource {

func dataSourceAptimizerScopeRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetAptimizerScope(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_bandwidth.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func dataSourceBandwidth() *schema.Resource {

func dataSourceBandwidthRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetBandwidth(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_bgpneighbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func dataSourceBgpneighbor() *schema.Resource {

func dataSourceBgpneighborRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetBgpneighbor(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_cloud_api_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func dataSourceCloudApiCredential() *schema.Resource {

func dataSourceCloudApiCredentialRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetCloudApiCredential(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func dataSourceCustom() *schema.Resource {

func dataSourceCustomRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetCustom(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_dns_server_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func dataSourceDnsServerZone() *schema.Resource {

func dataSourceDnsServerZoneRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetDnsServerZone(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_dns_server_zone_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceDnsServerZoneFile() *schema.Resource {

func dataSourceDnsServerZoneFileRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetDnsServerZoneFile(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_event_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ func dataSourceEventType() *schema.Resource {

func dataSourceEventTypeRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetEventType(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_extra_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceExtraFile() *schema.Resource {

func dataSourceExtraFileRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetExtraFile(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_glb_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ func dataSourceGlbService() *schema.Resource {

func dataSourceGlbServiceRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetGlbService(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_kerberos_keytab.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceKerberosKeytab() *schema.Resource {

func dataSourceKerberosKeytabRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetKerberosKeytab(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_kerberos_krb5conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceKerberosKrb5Conf() *schema.Resource {

func dataSourceKerberosKrb5ConfRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetKerberosKrb5Conf(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_kerberos_principal.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func dataSourceKerberosPrincipal() *schema.Resource {

func dataSourceKerberosPrincipalRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetKerberosPrincipal(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_license_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceLicenseKey() *schema.Resource {

func dataSourceLicenseKeyRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetLicenseKey(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func dataSourceLocation() *schema.Resource {

func dataSourceLocationRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetLocation(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_log_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ func dataSourceLogExport() *schema.Resource {

func dataSourceLogExportRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetLogExport(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ func dataSourceMonitor() *schema.Resource {

func dataSourceMonitorRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetMonitor(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_monitor_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceMonitorScript() *schema.Resource {

func dataSourceMonitorScriptRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetMonitorScript(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func dataSourcePersistence() *schema.Resource {

func dataSourcePersistenceRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetPersistence(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,10 @@ func dataSourcePool() *schema.Resource {

func dataSourcePoolRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetPool(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ func dataSourceProtection() *schema.Resource {

func dataSourceProtectionRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetProtection(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ func dataSourceRate() *schema.Resource {

func dataSourceRateRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetRate(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceRule() *schema.Resource {

func dataSourceRuleRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetRule(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_rule_authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func dataSourceRuleAuthenticator() *schema.Resource {

func dataSourceRuleAuthenticatorRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetRuleAuthenticator(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_service_level_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func dataSourceServiceLevelMonitor() *schema.Resource {

func dataSourceServiceLevelMonitorRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetServiceLevelMonitor(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_ssl_ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ func dataSourceSslCa() *schema.Resource {

func dataSourceSslCaRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetSslCa(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_ssl_client_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func dataSourceSslClientKey() *schema.Resource {

func dataSourceSslClientKeyRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetSslClientKey(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_ssl_server_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func dataSourceSslServerKey() *schema.Resource {

func dataSourceSslServerKeyRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetSslServerKey(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_traffic_ip_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ func dataSourceTrafficIpGroup() *schema.Resource {

func dataSourceTrafficIpGroupRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetTrafficIpGroup(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_traffic_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,10 @@ func dataSourceTrafficManager() *schema.Resource {

func dataSourceTrafficManagerRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetTrafficManager(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_user_authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ func dataSourceUserAuthenticator() *schema.Resource {

func dataSourceUserAuthenticatorRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetUserAuthenticator(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_user_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func dataSourceUserGroup() *schema.Resource {

func dataSourceUserGroupRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetUserGroup(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
4 changes: 4 additions & 0 deletions 4.0.0/data_source_config_virtual_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,10 @@ func dataSourceVirtualServer() *schema.Resource {

func dataSourceVirtualServerRead(d *schema.ResourceData, tm interface{}) error {
objectName := d.Get("name").(string)
if objectName == "" {
objectName = d.Id()
d.Set("name", objectName)
}
object, err := tm.(*vtm.VirtualTrafficManager).GetVirtualServer(objectName)
if err != nil {
if err.ErrorId == "resource.not_found" {
Expand Down
Loading

0 comments on commit 72a06a8

Please sign in to comment.