Skip to content
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

Closed
wants to merge 48 commits into from
Closed

New resources: azurerm_eventhub_namespace_dedicated and azurerm_eventhub_dedicated #7347

wants to merge 48 commits into from

Conversation

favoretti
Copy link
Collaborator

@favoretti favoretti commented Jun 16, 2020

Support of 2 new resources - azurerm_eventhub_dedicated and azurerm_eventhub_namespace_dedicated. See discussion below.

@ghost ghost added the size/XS label Jun 16, 2020
@favoretti
Copy link
Collaborator Author

favoretti commented Jun 16, 2020

@mbfrahry Would you be so kind to have a look? This one stands in the way of creating larger hubs on EventHub Clusters.

@favoretti favoretti changed the title Adjust partition count validator Adjust partition count and retention count validators Jun 16, 2020
@favoretti
Copy link
Collaborator Author

@jackofallops since you've reviewed Matthew's work on eventhub_cluster resource, can you have a look at this as well please?

@ghost ghost added size/XXL and removed size/XS labels Jun 22, 2020
@favoretti favoretti changed the title Adjust partition count and retention count validators New resources: azurerm_eventhub_namespace_dedicated and azurerm_eventhub_dedicated Jun 22, 2020
@ghost ghost added the documentation label Jun 22, 2020
@favoretti
Copy link
Collaborator Author

@jackofallops can you have a look please? If this is ok and merged, I’ll make another PR for data sources.

Copy link
Member

@jackofallops jackofallops left a 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!

CHANGELOG.md Outdated Show resolved Hide resolved
website/docs/r/eventhub_dedicated.html.markdown Outdated Show resolved Hide resolved
website/docs/r/eventhub_dedicated.html.markdown Outdated Show resolved Hide resolved
website/docs/r/eventhub_dedicated.html.markdown Outdated Show resolved Hide resolved
website/docs/r/eventhub_namespace_dedicated.html.markdown Outdated Show resolved Hide resolved
favoretti and others added 17 commits June 27, 2020 10:40
@favoretti
Copy link
Collaborator Author

after some internal discussion and that these belong to a cluster i think azurerm_eventhub_cluster_hub and azurerm_eventhub_cluster_[hub_]namespace would make the most sense?

@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).

azurerm_eventhub_cluster_namespace and azurerm_eventhub_cluster_eventhub? The latter would be quite a repetition, although can't do much about the fact that Event Hubs Cluster is called that way..

@ghost ghost removed the waiting-response label Jun 29, 2020
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a 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 {
Copy link
Contributor

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,
Copy link
Contributor

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 {
Copy link
Contributor

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,
Copy link
Contributor

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:

Suggested change
ClusterArmID: &clusterID,

ClusterArmID: &clusterID,
},
Tags: tags.Expand(t),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. and then:

Suggested change
}
}
if v := d.Get("cluster_id").(string); v != "" {
parameters.EHNamespaceProperties.ClusterArmID = utils.String(v)
}

ValidateFunc: azure.ValidateEventHubNamespaceName(),
},

"cluster_id": {
Copy link
Contributor

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:

Suggested change
"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)

Copy link
Collaborator Author

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 :)

@favoretti
Copy link
Collaborator Author

favoretti commented Jun 30, 2020

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

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)

@favoretti
Copy link
Collaborator Author

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.

@jackofallops
Copy link
Member

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.

@favoretti
Copy link
Collaborator Author

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?

@djsly
Copy link
Contributor

djsly commented Jun 30, 2020 via email

@favoretti
Copy link
Collaborator Author

Closing this one in favor of #7548.

@favoretti favoretti closed this Jul 1, 2020
@ghost
Copy link

ghost commented Aug 1, 2020

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!

@ghost ghost locked and limited conversation to collaborators Aug 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants