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_event_subscription #2967

Merged
merged 8 commits into from Feb 28, 2019

Conversation

mbfrahry
Copy link
Member

@mbfrahry mbfrahry commented Feb 28, 2019

This PR adds eventgrid event subscription to the azure provider. Addresses #1794.

=== RUN   TestAccAzureRMEventGridEventSubscription_basic
=== PAUSE TestAccAzureRMEventGridEventSubscription_basic
=== RUN   TestAccAzureRMEventGridEventSubscription_eventhub
=== PAUSE TestAccAzureRMEventGridEventSubscription_eventhub
=== RUN   TestAccAzureRMEventGridEventSubscription_update
=== PAUSE TestAccAzureRMEventGridEventSubscription_update
=== RUN   TestAccAzureRMEventGridEventSubscription_filter
=== PAUSE TestAccAzureRMEventGridEventSubscription_filter
=== CONT  TestAccAzureRMEventGridEventSubscription_basic
=== CONT  TestAccAzureRMEventGridEventSubscription_eventhub
=== CONT  TestAccAzureRMEventGridEventSubscription_update
=== CONT  TestAccAzureRMEventGridEventSubscription_filter
--- PASS: TestAccAzureRMEventGridEventSubscription_filter (178.35s)
--- PASS: TestAccAzureRMEventGridEventSubscription_basic (178.35s)
--- PASS: TestAccAzureRMEventGridEventSubscription_eventhub (238.15s)
--- PASS: TestAccAzureRMEventGridEventSubscription_update (259.45s)

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the pr @mbfrahry,

I've left some comments inline, mostly regarding additional validation. Once thats sorted this should be good to merge.

Type: schema.TypeString,
Required: true,
ForceNew: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we get some validation here? at the very least validate.NoEmptyStrings

Type: schema.TypeString,
Required: true,
ForceNew: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we get some validation here? at the very least validate.NoEmptyStrings

"storage_account_id": {
Type: schema.TypeString,
Required: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we validate this resource id? azure.ValidateResourceId

"queue_name": {
Type: schema.TypeString,
Required: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we get some validation here? at the very least validate.NoEmptyStrings

"eventhub_id": {
Type: schema.TypeString,
Required: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

COuld we validate this resource id?

"event_time_to_live": {
Type: schema.TypeInt,
Required: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a valid rage we could validate here?

func expandEventGridEventSubscriptionFilter(d *schema.ResourceData) *eventgrid.EventSubscriptionFilter {
filter := &eventgrid.EventSubscriptionFilter{}

if includedEvents, ok := d.GetOk("included_event_types"); ok {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this could be replaced with utils.ExpandeStringArray?

return nil
}

func expandEventGridEventSubscriptionLabels(d *schema.ResourceData) *[]string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be replaced with utils.ExpandStringArray?


resource "azurerm_eventgrid_event_subscription" "default" {
name = "defaultEventSubscription"
scope = "${azurerm_resource_group.default.id}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we fix the formatting/alignment here?

* `hybrid_connection_endpoint` - (Optional) A `hybrid_connection_endpoint` block as defined below.

* `webhook_endpoint` - (Optional) A `webhook_endpoint` block as defined below.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we add a note letting readers know that one of the above blocks is required?

},
"case_sensitive": {
Type: schema.TypeBool,
Optional: true,
Copy link
Member

Choose a reason for hiding this comment

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

by being Optional this implicitly has a default of false, which is may be worth highlighting in the docs

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@tombuildsstuff tombuildsstuff changed the title F eventgrid event subscription New Resource: azurerm_eventgrid_subscription Feb 28, 2019
@tombuildsstuff tombuildsstuff changed the title New Resource: azurerm_eventgrid_subscription New Resource: azurerm_eventgrid_event_subscription Feb 28, 2019
@mbfrahry
Copy link
Member Author

Thanks for the review @katbyte and @tombuildsstuff. I believe I've addressed all the comments

@katbyte katbyte self-assigned this Feb 28, 2019
Co-Authored-By: mbfrahry <mbfrahry@gmail.com>
@katbyte
Copy link
Collaborator

katbyte commented Feb 28, 2019

Thanks for the updates! LGTM now 🚀

@katbyte katbyte merged commit 2468103 into master Feb 28, 2019
@katbyte katbyte deleted the f-eventgrid-event-subscription branch February 28, 2019 22:42
katbyte added a commit that referenced this pull request Feb 28, 2019
@ghost
Copy link

ghost commented Mar 8, 2019

This has been released in version 1.23.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
	version = "~> 1.23.0"
}
# ... other configuration ...

@ghost ghost removed the waiting-response label Mar 8, 2019
@ghost
Copy link

ghost commented Mar 31, 2019

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Mar 31, 2019
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.

None yet

3 participants