-
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
New resources: azurerm_eventhub_namespace_dedicated and azurerm_eventhub_dedicated #7347
New resources: azurerm_eventhub_namespace_dedicated and azurerm_eventhub_dedicated #7347
Conversation
@mbfrahry Would you be so kind to have a look? This one stands in the way of creating larger hubs on EventHub Clusters. |
@jackofallops since you've reviewed Matthew's work on eventhub_cluster resource, can you have a look at this as well please? |
@jackofallops can you have a look please? If this is ok and merged, I’ll make another PR for data sources. |
Adjust partition count validator to support Event Hubs Cluster partition counts. See https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-dedicated-overview#event-hubs-dedicated-quotas-and-limits for details.
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.
Hi @favoretti
Thanks for updating this to create the new resources, it's off to a really good start. I've left some comments and suggestions below, mostly around removing duplication and reusing code that's common with the original resources, with a few other tweaks.
One important thing, the changelog is only updated when a maintainer merges a PR when it's ready. I appreciate the thoroughness, but we'll that one backing out if you can.
Thanks again!
azurerm/internal/services/eventhub/eventhub_dedicated_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/eventhub/eventhub_dedicated_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/eventhub/eventhub_dedicated_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/eventhub/eventhub_dedicated_resource.go
Outdated
Show resolved
Hide resolved
azurerm/internal/services/eventhub/tests/eventhub_dedicated_resource_test.go
Outdated
Show resolved
Hide resolved
Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
…d_resource.go Co-authored-by: Steve <[email protected]>
@katbyte Naming here a bit awkward. Generally relation is Event Hub Cluster -> Namespace(s) -> EventHub(s). For the non-dedicated part it's just Namespace(s) -> EventHub(s).
|
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.
hey @favoretti
Thanks for this PR :)
I've taken a look through here and we've had a chat about this internally - and ultimately we believe in this instance this'd make sense to reuse the existing azurerm_eventhub_namespace
and azurerm_eventhub
resources - rather than duplicating them for this single field - since based on what we can tell in the Azure API docs these should be complementary (ignoring validation/cluster specific configuration) rather than diverging. We've also discussed that the azurerm_eventhub_cluster
resource probably wants to become azurerm_eventhub_dedicated_cluster
- but that's a larger issue and probably a 3.0 thing.
Whilst I appreciate that's quite a substantial change from this PR - in practice these resources are essentially the same and so this likely makes the most sense until they substantially diverge - what do you think? :)
Thanks
|
||
var eventHubDedicatedResourceName = "azurerm_eventhub_dedicated" | ||
|
||
func resourceArmEventHubDedicated() *schema.Resource { |
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.
taking a look through this appears to be the same as the azurerm_eventhub
resource, so I think we can remove this and reuse that instead?
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: azure.ValidateResourceID, |
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.
can we add a validation function to confirm this is the ID of EventHub Dedicated Cluster? there's examples in the ./azurerm/internal/services/{...}/validate
folders
// default connection strings and keys | ||
var eventHubNamespaceDedicatedResourceName = "azurerm_eventhub_namespace_dedicated" | ||
|
||
func resourceArmEventHubNamespaceDedicated() *schema.Resource { |
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.
after chatting internally - rather than splitting this out into it's own resource, since the only difference between these two resources is validation, could we add dedicated_cluster_id
as an optional field to azurerm_eventhub_namespace
with regards to the validation differences - since we're already conditionally capturing this logic via the create
call for network rules - we can catch this in the same manner for non-dedicated clusters during the create
- so it should be possible to reuse these for the moment
}, | ||
EHNamespaceProperties: &eventhub.EHNamespaceProperties{ | ||
IsAutoInflateEnabled: utils.Bool(autoInflateEnabled), | ||
ClusterArmID: &clusterID, |
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.
since we'll be inlining this within the main resource, this'll need to be:
ClusterArmID: &clusterID, |
ClusterArmID: &clusterID, | ||
}, | ||
Tags: tags.Expand(t), | ||
} |
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.
.. and then:
} | |
} | |
if v := d.Get("cluster_id").(string); v != "" { | |
parameters.EHNamespaceProperties.ClusterArmID = utils.String(v) | |
} |
ValidateFunc: azure.ValidateEventHubNamespaceName(), | ||
}, | ||
|
||
"cluster_id": { |
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.
since this is kind of ambiguous, it'd be worth probably calling this out as:
"cluster_id": { | |
"dedicated_cluster_id": { |
(FWIW chatting internally we believe the azurerm_eventhub_cluster
resource should probably be named azurerm_eventhub_dedicated_cluster
, but that's a larger discussion)
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.
If we're going to ditch dedicated resources, this change will become obsolete then? I'm getting lost in diverging review opinions to be honest :)
Right... :D @tombuildsstuff Back to where we started. Adding an optional |
Also there's a challenge when we validate the limits for eventHub partition count and retention settings, where the whole discussion actually started. If I add optional field to namespace, this won't address eventhub validation challenge, since that one is unaware of where it's being created. |
Apologies, quite often we find ourselves part way down an implementation path before we find we've gone in the wrong direction. I've been there myself a lot over the years... Making the existing resource fit a preview API felt wrong at the time, but deeper inspection as this has progressed has brought us full circle. On the validation point, we'll need to tackle it in the manner I would have preferred we could avoid. The schema validation will need to cover both sets of possibilities, and the code will need to react to those values based on the presence of the |
No worries at all. I'll probably just abandon this and create a new PR with optional |
Personally I think it makes more sense.
Leveraging the existing namespace resources with an optional clusterID
… On Jun 30, 2020, at 9:37 AM, Vladimir Lazarenko ***@***.***> wrote:
Right... :D @tombuildsstuff Back to where we started. Adding an optional clusterID field to existing namespace was my initial suggestion, @jackofallops said duping them would be a better option. I'm happy to rework this again, but can you folks agree on one way to go? :) See #7347 (comment)
Apologies, quite often we find ourselves part way down an implementation path before we find we've gone in the wrong direction. I've been there myself a lot over the years... Making the existing resource fit a preview API felt wrong at the time, but deeper inspection as this has progressed has brought us full circle.
On the validation point, we'll need to tackle it in the manner I would have preferred we could avoid. The schema validation will need to cover both sets of possibilities, and the code will need to react to those values based on the presence of the dedicated_cluster_id attribute.
No worries at all. I'll probably just abandon this and create a new PR with optional dedicated_cluster_id attribute. We'll tackle validation from there on?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Closing this one in favor of #7548. |
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! |
Support of 2 new resources -
azurerm_eventhub_dedicated
andazurerm_eventhub_namespace_dedicated
. See discussion below.