-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 public_network_access_enabled
#8586
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -9,7 +9,7 @@ import ( | |||||||
"strings" | ||||||||
"time" | ||||||||
|
||||||||
"github.com/Azure/azure-sdk-for-go/services/preview/iothub/mgmt/2019-03-22-preview/devices" | ||||||||
"github.com/Azure/azure-sdk-for-go/services/iothub/mgmt/2020-03-01/devices" | ||||||||
"github.com/hashicorp/go-azure-helpers/response" | ||||||||
"github.com/hashicorp/terraform-plugin-sdk/helper/resource" | ||||||||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||||||||
|
@@ -403,6 +403,11 @@ func resourceArmIotHub() *schema.Resource { | |||||||
}, | ||||||||
}, | ||||||||
|
||||||||
"public_network_access": { | ||||||||
Type: schema.TypeBool, | ||||||||
Optional: true, | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this need to default to enabled? it'd be good to confirm with the portal's behaviour There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't specify it when creating an iothub, it doesn't get returned by the api so I don't think we can default it without breaking people. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
}, | ||||||||
|
||||||||
"type": { | ||||||||
Type: schema.TypeString, | ||||||||
Computed: true, | ||||||||
|
@@ -508,6 +513,15 @@ func resourceArmIotHubCreateUpdate(d *schema.ResourceData, meta interface{}) err | |||||||
Tags: tags.Expand(d.Get("tags").(map[string]interface{})), | ||||||||
} | ||||||||
|
||||||||
// nolint staticcheck | ||||||||
if v, ok := d.GetOkExists("public_network_access"); ok { | ||||||||
enabled := devices.Disabled | ||||||||
if v.(bool) { | ||||||||
enabled = devices.Enabled | ||||||||
} | ||||||||
props.Properties.PublicNetworkAccess = enabled | ||||||||
} | ||||||||
|
||||||||
retention, retentionOk := d.GetOk("event_hub_retention_in_days") | ||||||||
partition, partitionOk := d.GetOk("event_hub_partition_count") | ||||||||
if partitionOk || retentionOk { | ||||||||
|
@@ -621,6 +635,10 @@ func resourceArmIotHubRead(d *schema.ResourceData, meta interface{}) error { | |||||||
if err := d.Set("file_upload", fileUpload); err != nil { | ||||||||
return fmt.Errorf("Error setting `file_upload` in IoTHub %q: %+v", name, err) | ||||||||
} | ||||||||
|
||||||||
if enabled := properties.PublicNetworkAccess; enabled != "" { | ||||||||
d.Set("public_network_access", enabled == devices.Enabled) | ||||||||
} | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. couldn't we could make this:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure could |
||||||||
} | ||||||||
|
||||||||
d.Set("name", name) | ||||||||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
public_network_access_enabled
?