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_iothub] - support for the file_upload property #3735

Merged

Conversation

jhosteny
Copy link
Contributor

@jhosteny jhosteny commented Jun 26, 2019

Fixes #2948.

Remarks

This PR adds support for file uploads and notifications to IoT Hub.

Example

resource "azurerm_resource_group" "test" {    
  name     = "resourceGroup1"    
  location = "West US"    
}    
      
resource "azurerm_storage_account" "test" {    
  name                     = "teststa"    
  resource_group_name      = "${azurerm_resource_group.test.name}"    
  location                 = "${azurerm_resource_group.test.location}"    
  account_tier             = "Standard"    
  account_replication_type = "LRS"    
}    
      
resource "azurerm_storage_container" "test" {    
  name                  = "test"    
  resource_group_name   = "${azurerm_resource_group.test.name}"    
  storage_account_name  = "${azurerm_storage_account.test.name}"    
  container_access_type = "private"    
}

resource "azurerm_iothub" "test" {    
  name                = "test"
  resource_group_name = "${azurerm_resource_group.test.name}"
  location            = "${azurerm_resource_group.test.location}"                                                                                                                                  
  sku {    
    name     = "S1"
    tier     = "Standard"
    capacity = "1"       
  }

  file_upload {
    connection_string  = "${azurerm_storage_account.test.primary_blob_connection_string}"
    container_name     = "${azurerm_storage_container.test.name}"
    sas_ttl            = "PT1H"
    notifications      = true
    lock_duration      = "PT1M"
    default_ttl        = "PT1H"
    max_delivery_count = 10
  }
}

Acceptance Tests

]$ make testacc TESTARGS='-run=TestAccAzureRMIotHub'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor'|grep -v 'examples') -v -run=TestAccAzureRMIotHub -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
?   	github.com/terraform-providers/terraform-provider-azurerm	[no test files]
=== RUN   TestAccAzureRMIotHubConsumerGroup_events
=== PAUSE TestAccAzureRMIotHubConsumerGroup_events
=== RUN   TestAccAzureRMIotHubConsumerGroup_requiresImport
--- SKIP: TestAccAzureRMIotHubConsumerGroup_requiresImport (0.00s)
	resource_arm_iothub_consumer_group_test.go:41: Skipping since resources aren't required to be imported
=== RUN   TestAccAzureRMIotHubConsumerGroup_operationsMonitoringEvents
=== PAUSE TestAccAzureRMIotHubConsumerGroup_operationsMonitoringEvents
=== RUN   TestAccAzureRMIotHubSharedAccessPolicy_basic
=== PAUSE TestAccAzureRMIotHubSharedAccessPolicy_basic
=== RUN   TestAccAzureRMIotHubSharedAccessPolicy_writeWithoutRead
=== PAUSE TestAccAzureRMIotHubSharedAccessPolicy_writeWithoutRead
=== RUN   TestAccAzureRMIotHubSharedAccessPolicy_requiresImport
--- SKIP: TestAccAzureRMIotHubSharedAccessPolicy_requiresImport (0.00s)
	resource_arm_iothub_shared_access_policy_test.go:63: Skipping since resources aren't required to be imported
=== RUN   TestAccAzureRMIotHub_basic
=== PAUSE TestAccAzureRMIotHub_basic
=== RUN   TestAccAzureRMIotHub_ipFilterRules
=== PAUSE TestAccAzureRMIotHub_ipFilterRules
=== RUN   TestAccAzureRMIotHub_requiresImport
--- SKIP: TestAccAzureRMIotHub_requiresImport (0.00s)
	resource_arm_iothub_test.go:64: Skipping since resources aren't required to be imported
=== RUN   TestAccAzureRMIotHub_standard
=== PAUSE TestAccAzureRMIotHub_standard
=== RUN   TestAccAzureRMIotHub_customRoutes
=== PAUSE TestAccAzureRMIotHub_customRoutes
=== RUN   TestAccAzureRMIotHub_fileUpload
=== PAUSE TestAccAzureRMIotHub_fileUpload
=== RUN   TestAccAzureRMIotHub_fallbackRoute
=== PAUSE TestAccAzureRMIotHub_fallbackRoute
=== CONT  TestAccAzureRMIotHubConsumerGroup_events
=== CONT  TestAccAzureRMIotHub_standard
=== CONT  TestAccAzureRMIotHub_ipFilterRules
=== CONT  TestAccAzureRMIotHub_fileUpload
=== CONT  TestAccAzureRMIotHub_customRoutes
=== CONT  TestAccAzureRMIotHubSharedAccessPolicy_writeWithoutRead
=== CONT  TestAccAzureRMIotHub_fallbackRoute
=== CONT  TestAccAzureRMIotHubSharedAccessPolicy_basic
--- PASS: TestAccAzureRMIotHubSharedAccessPolicy_writeWithoutRead (4.57s)
=== CONT  TestAccAzureRMIotHubConsumerGroup_operationsMonitoringEvents
--- PASS: TestAccAzureRMIotHub_ipFilterRules (390.99s)
=== CONT  TestAccAzureRMIotHub_basic
--- PASS: TestAccAzureRMIotHub_fallbackRoute (450.21s)
--- PASS: TestAccAzureRMIotHubConsumerGroup_events (470.32s)
--- PASS: TestAccAzureRMIotHub_customRoutes (597.95s)
--- PASS: TestAccAzureRMIotHub_basic (443.31s)
--- PASS: TestAccAzureRMIotHub_standard (864.37s)
--- PASS: TestAccAzureRMIotHub_fileUpload (955.01s)
--- PASS: TestAccAzureRMIotHubConsumerGroup_operationsMonitoringEvents (950.62s)
--- PASS: TestAccAzureRMIotHubSharedAccessPolicy_basic (1067.35s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1067.379s

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 @jhosteny

Thanks for this PR :)

Taking a look through this if we can add a nil-check to the flatten function (to catch a potential crash) this otherwise LGTM 👍

Thanks!

azurerm/resource_arm_iothub.go Outdated Show resolved Hide resolved
@tombuildsstuff tombuildsstuff added this to the v1.32.0 milestone Jul 1, 2019
@katbyte katbyte changed the title Adds support for file uploads to IoT Hub. Fixes #2948. [azurerm_iothub] - support for the file_upload property Jul 6, 2019
@katbyte katbyte merged commit 52c40c7 into hashicorp:master Jul 6, 2019
katbyte added a commit that referenced this pull request Jul 6, 2019
@ghost
Copy link

ghost commented Jul 30, 2019

This has been released in version 1.32.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.32.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Aug 6, 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 👉 [email protected]. Thanks!

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

Azure IoT Hub File Upload Support
3 participants