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 Resource: azurerm_eventgrid_namespace #27682

Merged
merged 10 commits into from
Nov 19, 2024
Merged

Conversation

catriona-m
Copy link
Member

@catriona-m catriona-m commented Oct 17, 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

Adding azurerm_eventgrid_namespace as a new resource.

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

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.

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 #24079

Note

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

@catriona-m catriona-m marked this pull request as draft October 17, 2024 14:57
@catriona-m catriona-m marked this pull request as ready for review October 25, 2024 14:48
@catriona-m catriona-m requested review from katbyte and a team as code owners October 25, 2024 14:48
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, could you take a look at the review comments left in-line?

PublicNetworkAccess string `tfschema:"public_network_access"`
Sku string `tfschema:"sku"`
TopicSpacesConfiguration []TopicSpacesConfigurationModel `tfschema:"topic_spaces_configuration"`
ZoneRedundant bool `tfschema:"zone_redundant"`
Copy link
Member

Choose a reason for hiding this comment

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

This field was deprecated and removed in 4.0 not too long ago for the service bus and event hub namespace resources. We may want to check with MSFT whether this is also the case for event grid before exposing this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @stephybun - I tested this and confirmed the api handles setting this based on location so it can be removed here 👍

"inbound_ip_rule": {
Type: pluginsdk.TypeList,
Optional: true,
ConfigMode: pluginsdk.SchemaConfigModeAttr,
Copy link
Member

Choose a reason for hiding this comment

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

This isn't Computed so I don't think we need to be setting this on the block

Suggested change
ConfigMode: pluginsdk.SchemaConfigModeAttr,

Comment on lines 161 to 169
"key": {
Type: pluginsdk.TypeString,
Required: true,
},

"value": {
Type: pluginsdk.TypeString,
Required: true,
},
Copy link
Member

Choose a reason for hiding this comment

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

Validation here?

Comment on lines 506 to 507


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


data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basicWithTags(data),
Copy link
Member

Choose a reason for hiding this comment

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

Tags can be updated but it looks like we don't cover this in the tests


* `location` - (Required) Specifies the supported Azure location where the resource should exist. Changing this forces a new resource to be created.

* `capacity` - (Optional) (Optional) Specifies the Capacity / Throughput Units for an Eventgrid Namespace. Valid values can be between `1` and `40`.
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
* `capacity` - (Optional) (Optional) Specifies the Capacity / Throughput Units for an Eventgrid Namespace. Valid values can be between `1` and `40`.
* `capacity` - (Optional) Specifies the Capacity / Throughput Units for an Eventgrid Namespace. Valid values can be between `1` and `40`.


* `alternative_authentication_name_source` - (Optional) Specifies a list of alternative sources for the client authentication name from the client certificate. Possible values are `ClientCertificateDns`, `ClientCertificateEmail`, `ClientCertificateIp`, `ClientCertificateSubject` and `ClientCertificateUri`.

* `maximum_client_sessions_per_authentication_name` - (Optional) Specifies the maximum number of client sessions epr authentication name. Valid values can be between `1` and `100`.
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
* `maximum_client_sessions_per_authentication_name` - (Optional) Specifies the maximum number of client sessions epr authentication name. Valid values can be between `1` and `100`.
* `maximum_client_sessions_per_authentication_name` - (Optional) Specifies the maximum number of client sessions per authentication name. Valid values can be between `1` and `100`.


* `maximum_session_expiry_in_hours` - (Optional) Specifies the maximum session expiry interval allowed for all MQTT clients connecting to the Event Grid namespace. Valid values can be between `1` and `8`.

* `route_topic_id` - (Optional) Specifies the Event Grid topic resource id to route messages to.
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
* `route_topic_id` - (Optional) Specifies the Event Grid topic resource id to route messages to.
* `route_topic_id` - (Optional) Specifies the Event Grid topic resource ID to route messages to.

@sbugalski
Copy link

sbugalski commented Nov 4, 2024

Many thanks for the work.

Any update on this please?

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. A few more minor comments, but other than that this LGTM provided the tests are passing!

}

func flattenInboundIPRules(ipRules *[]namespaces.InboundIPRule) []InboundIpRuleModel {
var output []InboundIpRuleModel
Copy link
Member

@stephybun stephybun Nov 19, 2024

Choose a reason for hiding this comment

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

Forgot to flag this in my previous review, there is a difference between declaring a slice like this and like
output := make([]InboundIpRuleModel, 0)

Which is that the declaration var output []InboundIpRuleModel evaluates to nil if nothing has been appended to it, whereas initialising it with make will result in an empty slice [] which is what we want when setting values into state.

Can you please update this, as well as all the other flatten functions to

Suggested change
var output []InboundIpRuleModel
output := make([]InboundIpRuleModel, 0)

`, data.RandomInteger, data.Locations.Primary)
}

func (r EventGridNamespaceResource) basicWithTags(data acceptance.TestData) string {
Copy link
Member

Choose a reason for hiding this comment

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

Minor but we could just call this

Suggested change
func (r EventGridNamespaceResource) basicWithTags(data acceptance.TestData) string {
func (r EventGridNamespaceResource) tags(data acceptance.TestData) string {

`, data.RandomInteger, data.Locations.Primary)
}

func (r EventGridNamespaceResource) basicWithTagsUpdated(data acceptance.TestData) string {
Copy link
Member

Choose a reason for hiding this comment

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

Likewise

Suggested change
func (r EventGridNamespaceResource) basicWithTagsUpdated(data acceptance.TestData) string {
func (r EventGridNamespaceResource) tagsUpdated(data acceptance.TestData) string {

@catriona-m
Copy link
Member Author

catriona-m commented Nov 19, 2024

Thanks @catriona-m. A few more minor comments, but other than that this LGTM provided the tests are passing!

Thanks @stephybun - the tests are passing so going to merge this now 👍

image

@catriona-m catriona-m merged commit 780ebd8 into main Nov 19, 2024
33 checks passed
@catriona-m catriona-m deleted the cm/eventgridnamespace branch November 19, 2024 17:13
@github-actions github-actions bot added this to the v4.11.0 milestone Nov 19, 2024
catriona-m added a commit that referenced this pull request Nov 19, 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 20, 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.

Support Event Grid Namespaces and MQTT broker
4 participants