-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_servicebus_topic
- added a status
field to allow disabling the topic
#150
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
409f6c5
Cleaning up service bus namespaces
tombuildsstuff 1c68d84
Service Bus Topic's can be disabled
tombuildsstuff 20cca85
Refactoring
tombuildsstuff da0eb1e
Actually enabling disabled
tombuildsstuff 55a30f0
Adding the new field to the docs
tombuildsstuff 1eebdf4
Switching to use the azure wrappers
tombuildsstuff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import ( | |
|
||
"github.com/Azure/azure-sdk-for-go/arm/servicebus" | ||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/hashicorp/terraform/helper/validation" | ||
) | ||
|
||
// Default Authorization Rule/Policy created by Azure, used to populate the | ||
|
@@ -40,10 +41,14 @@ func resourceArmServiceBusNamespace() *schema.Resource { | |
}, | ||
|
||
"sku": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validateServiceBusNamespaceSku, | ||
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: validation.StringInSlice([]string{ | ||
string(servicebus.Basic), | ||
string(servicebus.Standard), | ||
string(servicebus.Premium), | ||
}, true), | ||
DiffSuppressFunc: ignoreCaseDiffSuppressFunc, | ||
}, | ||
|
||
|
@@ -83,7 +88,7 @@ func resourceArmServiceBusNamespace() *schema.Resource { | |
func resourceArmServiceBusNamespaceCreate(d *schema.ResourceData, meta interface{}) error { | ||
client := meta.(*ArmClient) | ||
namespaceClient := client.serviceBusNamespacesClient | ||
log.Printf("[INFO] preparing arguments for Azure ARM ServiceBus Namespace creation.") | ||
log.Printf("[INFO] preparing arguments for AzureRM ServiceBus Namespace creation.") | ||
|
||
name := d.Get("name").(string) | ||
location := d.Get("location").(string) | ||
|
@@ -134,7 +139,7 @@ func resourceArmServiceBusNamespaceRead(d *schema.ResourceData, meta interface{} | |
|
||
resp, err := namespaceClient.Get(resGroup, name) | ||
if err != nil { | ||
return fmt.Errorf("Error making Read request on Azure ServiceBus Namespace %s: %+v", name, err) | ||
return fmt.Errorf("Error making Read request on Azure ServiceBus Namespace '%s': %+v", name, err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL, thanks! |
||
} | ||
if resp.StatusCode == http.StatusNotFound { | ||
d.SetId("") | ||
|
@@ -177,26 +182,12 @@ func resourceArmServiceBusNamespaceDelete(d *schema.ResourceData, meta interface | |
err = <-error | ||
|
||
if resp.StatusCode != http.StatusNotFound { | ||
return fmt.Errorf("Error issuing Azure ARM delete request of ServiceBus Namespace'%s': %+v", name, err) | ||
return fmt.Errorf("Error issuing Azure ARM delete request of ServiceBus Namespace '%s': %+v", name, err) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func validateServiceBusNamespaceSku(v interface{}, k string) (ws []string, errors []error) { | ||
value := strings.ToLower(v.(string)) | ||
skus := map[string]bool{ | ||
"basic": true, | ||
"standard": true, | ||
"premium": true, | ||
} | ||
|
||
if !skus[value] { | ||
errors = append(errors, fmt.Errorf("ServiceBus Namespace SKU can only be Basic, Standard or Premium")) | ||
} | ||
return | ||
} | ||
|
||
func validateServiceBusNamespaceCapacity(v interface{}, k string) (ws []string, errors []error) { | ||
value := v.(int) | ||
capacities := map[int]bool{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job with simplification 👍