Merge pull request #13223 from tombuildsstuff/azurerm-servicebustopic

provider/azurerm: Setting an optional field on Service Bus Topic
This commit is contained in:
Tom Harvey 2017-04-10 14:35:22 +01:00 committed by GitHub
commit 906cd0946a
7 changed files with 13 additions and 12 deletions

View File

@ -132,7 +132,7 @@ func resourceArmServiceBusNamespaceRead(d *schema.ResourceData, meta interface{}
resp, err := namespaceClient.Get(resGroup, name) resp, err := namespaceClient.Get(resGroup, name)
if err != nil { if err != nil {
return fmt.Errorf("Error making Read request on Azure ServiceBus Namespace %s: %s", name, err) return fmt.Errorf("Error making Read request on Azure ServiceBus Namespace %s: %+v", name, err)
} }
if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {
d.SetId("") d.SetId("")
@ -147,7 +147,7 @@ func resourceArmServiceBusNamespaceRead(d *schema.ResourceData, meta interface{}
keys, err := namespaceClient.ListKeys(resGroup, name, serviceBusNamespaceDefaultAuthorizationRule) keys, err := namespaceClient.ListKeys(resGroup, name, serviceBusNamespaceDefaultAuthorizationRule)
if err != nil { if err != nil {
log.Printf("[ERROR] Unable to List default keys for Namespace %s: %s", name, err) log.Printf("[ERROR] Unable to List default keys for Namespace %s: %+v", name, err)
} else { } else {
d.Set("default_primary_connection_string", keys.PrimaryConnectionString) d.Set("default_primary_connection_string", keys.PrimaryConnectionString)
d.Set("default_secondary_connection_string", keys.SecondaryConnectionString) d.Set("default_secondary_connection_string", keys.SecondaryConnectionString)
@ -173,7 +173,7 @@ func resourceArmServiceBusNamespaceDelete(d *schema.ResourceData, meta interface
resp, err := namespaceClient.Delete(resGroup, name, make(chan struct{})) resp, err := namespaceClient.Delete(resGroup, name, make(chan struct{}))
if resp.StatusCode != http.StatusNotFound { if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("Error issuing Azure ARM delete request of ServiceBus Namespace'%s': %s", name, err) return fmt.Errorf("Error issuing Azure ARM delete request of ServiceBus Namespace'%s': %+v", name, err)
} }
return nil return nil

View File

@ -140,7 +140,7 @@ func testCheckAzureRMServiceBusNamespaceDestroy(s *terraform.State) error {
} }
if resp.StatusCode != http.StatusNotFound { if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("ServiceBus Namespace still exists:\n%#v", resp.NamespaceProperties) return fmt.Errorf("ServiceBus Namespace still exists:\n%+v", resp)
} }
} }
@ -165,7 +165,7 @@ func testCheckAzureRMServiceBusNamespaceExists(name string) resource.TestCheckFu
resp, err := conn.Get(resourceGroup, namespaceName) resp, err := conn.Get(resourceGroup, namespaceName)
if err != nil { if err != nil {
return fmt.Errorf("Bad: Get on serviceBusNamespacesClient: %s", err) return fmt.Errorf("Bad: Get on serviceBusNamespacesClient: %+v", err)
} }
if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {

View File

@ -163,7 +163,7 @@ func resourceArmServiceBusSubscriptionRead(d *schema.ResourceData, meta interfac
resp, err := client.Get(resGroup, namespaceName, topicName, name) resp, err := client.Get(resGroup, namespaceName, topicName, name)
if err != nil { if err != nil {
return fmt.Errorf("Error making Read request on Azure ServiceBus Subscription %s: %s", name, err) return fmt.Errorf("Error making Read request on Azure ServiceBus Subscription %s: %+v", name, err)
} }
if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {
d.SetId("") d.SetId("")

View File

@ -105,7 +105,7 @@ func testCheckAzureRMServiceBusSubscriptionDestroy(s *terraform.State) error {
} }
if resp.StatusCode != http.StatusNotFound { if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("ServiceBus Subscription still exists:\n%#v", resp.SubscriptionProperties) return fmt.Errorf("ServiceBus Subscription still exists:\n%+v", resp.SubscriptionProperties)
} }
} }
@ -132,7 +132,7 @@ func testCheckAzureRMServiceBusSubscriptionExists(name string) resource.TestChec
resp, err := client.Get(resourceGroup, namespaceName, topicName, subscriptionName) resp, err := client.Get(resourceGroup, namespaceName, topicName, subscriptionName)
if err != nil { if err != nil {
return fmt.Errorf("Bad: Get on serviceBusSubscriptionsClient: %s", err) return fmt.Errorf("Bad: Get on serviceBusSubscriptionsClient: %+v", err)
} }
if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {

View File

@ -55,6 +55,7 @@ func resourceArmServiceBusTopic() *schema.Resource {
"duplicate_detection_history_time_window": { "duplicate_detection_history_time_window": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true,
}, },
"enable_batched_operations": { "enable_batched_operations": {
@ -172,7 +173,7 @@ func resourceArmServiceBusTopicRead(d *schema.ResourceData, meta interface{}) er
resp, err := client.Get(resGroup, namespaceName, name) resp, err := client.Get(resGroup, namespaceName, name)
if err != nil { if err != nil {
return fmt.Errorf("Error making Read request on Azure ServiceBus Topic %s: %s", name, err) return fmt.Errorf("Error making Read request on Azure ServiceBus Topic %s: %+v", name, err)
} }
if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {
d.SetId("") d.SetId("")

View File

@ -165,7 +165,7 @@ func testCheckAzureRMServiceBusTopicDestroy(s *terraform.State) error {
} }
if resp.StatusCode != http.StatusNotFound { if resp.StatusCode != http.StatusNotFound {
return fmt.Errorf("ServiceBus Topic still exists:\n%#v", resp.TopicProperties) return fmt.Errorf("ServiceBus Topic still exists:\n%+v", resp.TopicProperties)
} }
} }
@ -191,7 +191,7 @@ func testCheckAzureRMServiceBusTopicExists(name string) resource.TestCheckFunc {
resp, err := client.Get(resourceGroup, namespaceName, topicName) resp, err := client.Get(resourceGroup, namespaceName, topicName)
if err != nil { if err != nil {
return fmt.Errorf("Bad: Get on serviceBusTopicsClient: %s", err) return fmt.Errorf("Bad: Get on serviceBusTopicsClient: %+v", err)
} }
if resp.StatusCode == http.StatusNotFound { if resp.StatusCode == http.StatusNotFound {

View File

@ -67,7 +67,7 @@ The following arguments are supported:
format. format.
* `duplicate_detection_history_time_window` - (Optional) The duration during which * `duplicate_detection_history_time_window` - (Optional) The duration during which
duplicates can be detected. Provided in the [TimeSpan](#timespan-format) format. duplicates can be detected. Provided in the [TimeSpan](#timespan-format) format. Defaults to 10 minutes (`00:10:00`)
* `enable_batched_operations` - (Optional) Boolean flag which controls if server-side * `enable_batched_operations` - (Optional) Boolean flag which controls if server-side
batched operations are enabled. Defaults to false. batched operations are enabled. Defaults to false.