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

azurerm_eventhub - deprecate namespace_name and resource_group_name in favour of namespace_id #28055

Merged
merged 12 commits into from
Nov 22, 2024

Conversation

catriona-m
Copy link
Member

@catriona-m catriona-m commented Nov 18, 2024

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevent documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)
image

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_eventhub - deprecate namespace_name and resource_group_name in favour of namespace_id [GH-00000]

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #27008

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks @catriona-m. Do the tests need to be updated as well?

Comment on lines 91 to 94
### `azurerm_eventhub`

* The deprecated `namespace_name` property has been removed in favour of the `namespace_id` property.

Copy link
Member

Choose a reason for hiding this comment

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

These should be listed in alphabetical order, so should be moved further up

Comment on lines 48 to 52
* `namespace_name` - (Optional) Specifies the name of the EventHub Namespace. Changing this forces a new resource to be created. This property is deprecated in favour of `namespace_id`.

* `namespace_id` - (Optional) Specifies the id of the EventHub Namespace. Changing this forces a new resource to be created.

~> **NOTE:** One of `namespace_name` or `namespace_id` must be specified.
Copy link
Member

Choose a reason for hiding this comment

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

We remove deprecated properties entirely from the documentation to discourage use of them

Suggested change
* `namespace_name` - (Optional) Specifies the name of the EventHub Namespace. Changing this forces a new resource to be created. This property is deprecated in favour of `namespace_id`.
* `namespace_id` - (Optional) Specifies the id of the EventHub Namespace. Changing this forces a new resource to be created.
~> **NOTE:** One of `namespace_name` or `namespace_id` must be specified.
* `namespace_id` - (Optional) Specifies the id of the EventHub Namespace. Changing this forces a new resource to be created.

r.Schema["namespace_id"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Copy link
Member

Choose a reason for hiding this comment

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

This probably shouldn't be ForceNew yet so that users can migrate over to using namespace_id

r.Schema["namespace_name"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Copy link
Member

Choose a reason for hiding this comment

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

Likewise here

Suggested change
ForceNew: true,

@@ -379,7 +379,7 @@ resource "azurerm_eventhub_namespace" "test" {

resource "azurerm_eventhub" "test" {
name = "acctesteventhub-%d"
namespace_name = azurerm_eventhub_namespace.test.name
namespace_id = azurerm_eventhub_namespace.test.id
Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming all the test configs have been updated to use namespace_id instead of namespace_name now, provided the migration path for users switching from namespace_name -> namespace_id works this is fine but it might be worth keeping one test config with namespace_name to ensure it's still functional for the time being e.g.

func (EventHubResource) basic(data acceptance.TestData, partitionCount int) string {
     if !features.FivePointOhBeta() {
        // return config using namespace_name here
}

// return config using namespace_id here
}

@CorrenSoft
Copy link
Contributor

Dumb question: Shouldn't be also the resource group deprecated?

@stephybun
Copy link
Member

@CorrenSoft not dumb at all, good catch 😄

Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.ValidateEventHubNamespaceName(),
ValidateFunc: namespaces.ValidateNamespaceID,
},

"resource_group_name": commonschema.ResourceGroupName(),
Copy link
Member

Choose a reason for hiding this comment

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

@catriona-m as pointed out by @CorrenSoft this probably wants to be deprecated as well

@github-actions github-actions bot added size/L and removed size/M labels Nov 21, 2024
@catriona-m catriona-m changed the title azurerm_eventhub - deprecate namespace_name in favour of namespace_id azurerm_eventhub - deprecate namespace_name and resource_group_name in favour of namespace_id Nov 21, 2024
@catriona-m
Copy link
Member Author

Thanks @CorrenSoft and @stephybun - I've added that change now and re-run the tests, which look good (apart from 2 flaky tests)

image

Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

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

Thanks @catriona-m. Once the deprecation messages and upgrade guide have been updated this LGTM ⛄

Computed: true,
ValidateFunc: validate.ValidateEventHubNamespaceName(),
ExactlyOneOf: []string{"namespace_id", "namespace_name"},
Deprecated: "`namespace_name` has been deprecated in favour of `namespace_id`",
Copy link
Member

Choose a reason for hiding this comment

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

Can't believe I didn't catch this in the previous review, but could we update this so it's consistent with other deprecation messages in the provider and also clear in that it will be removed in the next major release

Suggested change
Deprecated: "`namespace_name` has been deprecated in favour of `namespace_id`",
Deprecated: "`namespace_name` has been deprecated in favour of `namespace_id` and will be removed in v5.0 of the AzureRM Provider",

Computed: true,
ExactlyOneOf: []string{"namespace_id", "resource_group_name"},
ValidateFunc: resourcegroups.ValidateName,
Deprecated: "`resource_group_name` has been deprecated in favour of `namespace_id` ",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Deprecated: "`resource_group_name` has been deprecated in favour of `namespace_id` ",
Deprecated: "`resource_group_name` has been deprecated in favour of `namespace_id` and will be removed in v5.0 of the AzureRM Provider ",


* The deprecated `name` property has been removed.
* The deprecated `namespace_name` property has been removed in favour of the `namespace_id` property.
Copy link
Member

Choose a reason for hiding this comment

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

We need to add a line for the resource_group_name property here as well

@catriona-m catriona-m merged commit 3f13aa8 into main Nov 22, 2024
32 checks passed
@catriona-m catriona-m deleted the cm/eventhubid branch November 22, 2024 15:24
@github-actions github-actions bot added this to the v4.12.0 milestone Nov 22, 2024
catriona-m added a commit that referenced this pull request Nov 22, 2024
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2024
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.

azurerm_eventhub should accept namespace id as an input
3 participants