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: Notification Hubs #1589

Merged
merged 21 commits into from
Jul 19, 2018
Merged

New Resources: Notification Hubs #1589

merged 21 commits into from
Jul 19, 2018

Conversation

tombuildsstuff
Copy link
Contributor

@tombuildsstuff tombuildsstuff commented Jul 17, 2018

I went to start work on this and it turns out apparently I started this in April ¯_(ツ)_/¯

Notification Hub Namespaces

  • Data Source
  • Resource
  • Acceptance Tests
  • Documentation

Notification Hub

  • Data Source
  • Resource
  • Acceptance Tests
  • Documentation
  • Manual Testing of APNS
  • Manual Testing of GCM

Since this requires valid APNS and GCM credentials to test - I'll have to assert these manually for the moment; so the Acceptance Tests will be limited to the core Notification Hub workflow.

Notification Hub Authorization Rule

  • Resource
  • Acceptance Tests
  • Documentation

Other

```
$ acctests azurerm TestAccAzureRMNotificationHubNamespace_
=== RUN   TestAccAzureRMNotificationHubNamespace_importFree
--- PASS: TestAccAzureRMNotificationHubNamespace_importFree (134.35s)
=== RUN   TestAccAzureRMNotificationHubNamespace_free
--- PASS: TestAccAzureRMNotificationHubNamespace_free (126.57s)
=== RUN   TestAccAzureRMNotificationHubNamespace_updateSku
--- PASS: TestAccAzureRMNotificationHubNamespace_updateSku (143.16s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	404.111s
```
@tombuildsstuff tombuildsstuff added this to the 1.10.0 milestone Jul 17, 2018
```
$ acctests azurerm TestAccDataSourceAzureRMNotificationHubNamespace_free
=== RUN   TestAccDataSourceAzureRMNotificationHubNamespace_free
--- PASS: TestAccDataSourceAzureRMNotificationHubNamespace_free (130.03s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	130.081s
```
@tombuildsstuff tombuildsstuff changed the title [WIP] New Resources: Notification Hubs / Notification Hub Notifications [WIP] New Resources: Notification Hubs Jul 17, 2018
```
$ acctests azurerm TestAccAzureRMNotificationHub_basic
=== RUN   TestAccAzureRMNotificationHub_basic
--- PASS: TestAccAzureRMNotificationHub_basic (284.22s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	284.273s
```
@tombuildsstuff tombuildsstuff changed the title [WIP] New Resources: Notification Hubs New Resources: Notification Hubs Jul 18, 2018
Tests pass:
```
$ acctests azurerm TestAccAzureRMNotificationHubNamespace_
=== RUN   TestAccAzureRMNotificationHubNamespace_importFree
--- PASS: TestAccAzureRMNotificationHubNamespace_importFree (71.04s)
=== RUN   TestAccAzureRMNotificationHubNamespace_free
--- PASS: TestAccAzureRMNotificationHubNamespace_free (73.17s)
=== RUN   TestAccAzureRMNotificationHubNamespace_updateSku
--- PASS: TestAccAzureRMNotificationHubNamespace_updateSku (86.43s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	230.677s
```
@tombuildsstuff
Copy link
Contributor Author

Data Source tests pass:

$ acctests azurerm TestAccDataSourceAzureRMNotificationHub
=== RUN   TestAccDataSourceAzureRMNotificationHubNamespace_free
--- PASS: TestAccDataSourceAzureRMNotificationHubNamespace_free (71.81s)
=== RUN   TestAccDataSourceAzureRMNotificationHub_basic
--- PASS: TestAccDataSourceAzureRMNotificationHub_basic (118.11s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	189.967s

```
azurerm_notification_hub_namespace.test: Error creating/updating Notification Hub Namesapce "acctestnhn-4049058900878420170" (Resource Group "acctestrg-4049058900878420170"): notificationhubs.NamespacesClient#CreateOrUpdate: Failure sending request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="Conflict" Message="Namespace acctestnhn-4049058900878420170 is in state Created. Cannot update the property"
```
}

// try triggering a deleting again
client.Delete(ctx, resourceGroupName, name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just want to call this out as this looks odd on first glance - the Namespace delete method doesn't actually delete it some of the time, but repeatedly hitting it seems to work so 🙃

@tombuildsstuff
Copy link
Contributor Author

Resource tests pass:

screenshot 2018-07-18 at 21 41 07

@tombuildsstuff tombuildsstuff requested a review from a team July 18, 2018 19:41
@mbfrahry mbfrahry self-assigned this Jul 19, 2018
Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

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

LGTM with just a few minor nits

token := input["token"].(string)

applicationEndpoints := map[string]string{
"Production": "https://api.push.apple.com:443/3/device",
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on making the endpoints constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 done


if endpoint := input.Endpoint; endpoint != nil {
applicationEndpoints := map[string]string{
"https://api.push.apple.com:443/3/device": "Production",
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on making the endpoints constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 done

Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
// TODO: customizeDiff for send+listen when manage selected
Copy link
Member

Choose a reason for hiding this comment

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

Just confirming that this is for later down the road

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, it's documented so this isn't necessary at this time

return fmt.Errorf("Error waiting for Notification Hub %q (Resource Group %q) to be deleted: %s", name, resourceGroup, err)
}

err = future.WaitForCompletionRef(ctx, client.Client)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to comment this out until the issue mentioned above is fixed? Or is it fine to wait for when the namespace is deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️ I thought I'd done this, but yes you're right this should be removed

@tombuildsstuff
Copy link
Contributor Author

Data Source tests still pass:

$ acctests azurerm TestAccDataSourceAzureRMNotificationHub
=== RUN   TestAccDataSourceAzureRMNotificationHubNamespace_free
--- PASS: TestAccDataSourceAzureRMNotificationHubNamespace_free (89.20s)
=== RUN   TestAccDataSourceAzureRMNotificationHub_basic
--- PASS: TestAccDataSourceAzureRMNotificationHub_basic (116.10s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	205.673s

@tombuildsstuff
Copy link
Contributor Author

Resource tests pass:

screenshot 2018-07-19 at 13 26 53

@tombuildsstuff tombuildsstuff merged commit 724bff9 into master Jul 19, 2018
@tombuildsstuff tombuildsstuff deleted the notification-hubs branch July 19, 2018 11:27
tombuildsstuff added a commit that referenced this pull request Jul 19, 2018
@ghost
Copy link

ghost commented Mar 30, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 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.

2 participants