-
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
Conversation
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.
This looks overall good. I left you some comments there out of which 1 is probably more significant than others - pointer helper functions. Let me know what you think.
EnablePartitioning: &enablePartitioning, | ||
MaxSizeInMegabytes: &maxSize, | ||
RequiresDuplicateDetection: &requiresDuplicateDetection, | ||
SupportOrdering: &supportOrdering, |
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.
I think we'd benefit from having a provider-wide helper for creating these pointers here. AWS has its own in the SDK (aws.String()
, aws.Bool()
etc.) and I built similar ones in K8S: https://github.com/terraform-providers/terraform-provider-kubernetes/blob/master/kubernetes/structures.go#L124-L142
It may look like a nitpick, but you can effectively reduce the number of lines to half here.
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 shout - there's a ton built into Riviera - I'll switch this out
@@ -186,6 +200,7 @@ func resourceArmServiceBusTopicRead(d *schema.ResourceData, meta interface{}) er | |||
d.Set("location", azureRMNormalizeLocation(*resp.Location)) | |||
|
|||
props := resp.TopicProperties | |||
d.Set("status", string(props.Status)) |
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.
I'd think the Set
will take care of the casting, but maybe I'm wrong... 🤷♂️
{ | ||
Config: enabledConfig, | ||
Check: resource.ComposeTestCheckFunc( | ||
testCheckAzureRMServiceBusTopicExists(resourceName), |
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 thorough testing here, nice 👍
string(servicebus.Basic), | ||
string(servicebus.Standard), | ||
string(servicebus.Premium), | ||
}, true), |
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 👍
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
%q
would add double quotes around the string for you + escaped it properly here.
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.
TIL, thanks!
96e9e26
to
82792ff
Compare
82792ff
to
1eebdf4
Compare
Tests pass:
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Allows Service Bus Topic's to be set to a Disabled state.
Fixes #146
Tests pass: