azurerm_subnet - add support for sharing_scope#30600
azurerm_subnet - add support for sharing_scope#30600mbfrahry merged 6 commits intohashicorp:mainfrom
azurerm_subnet - add support for sharing_scope#30600Conversation
mbfrahry
left a comment
There was a problem hiding this comment.
Thanks for opening this PR. Just a few comments but it looks good otherwise
| Type: pluginsdk.TypeString, | ||
| Optional: true, | ||
| // now only "Tenant" is supported, "DelegatedServices" is not supported, https://github.com/Azure/azure-rest-api-specs/issues/36446 | ||
| ValidateFunc: validation.StringInSlice([]string{"Tenant"}, false), |
There was a problem hiding this comment.
| ValidateFunc: validation.StringInSlice([]string{"Tenant"}, false), | |
| ValidateFunc: validation.StringInSlice([]string{subnets.SharingScopeTenant}, false), |
There was a problem hiding this comment.
Updated. Thanks.
| serviceEndpointsRaw := d.Get("service_endpoints").(*pluginsdk.Set).List() | ||
| properties.ServiceEndpoints = expandSubnetServiceEndpoints(serviceEndpointsRaw) | ||
|
|
||
| properties.SharingScope = pointer.To(subnets.SharingScope(d.Get("sharing_scope").(string))) |
There was a problem hiding this comment.
| properties.SharingScope = pointer.To(subnets.SharingScope(d.Get("sharing_scope").(string))) | |
| properties.SharingScope = pointer.ToEnum[subnets.SharingScope](d.Get("sharing_scope").(string)) |
There was a problem hiding this comment.
Since Go generic currently can't infer the type from the LHS in an assignment statement, we have to explicitly specify the generic type as above. Wondering what is the benefit of using the ToEnum comparing to the To..
There was a problem hiding this comment.
Updated. Thanks.
|
|
||
| * `sharing_scope` - (Optional) The sharing scope of the subnet. Possible value is `Tenant`. This property cannot be set if `default_outbound_access_enabled` is set to `true`. | ||
|
|
||
| !> **Note:** The `sharing_scope` property is only available to users who have been explicitly registered and granted access by the Azure Networking Product Group. |
There was a problem hiding this comment.
I believe this note is unneeded
| !> **Note:** The `sharing_scope` property is only available to users who have been explicitly registered and granted access by the Azure Networking Product Group. |
There was a problem hiding this comment.
Updated. Thanks.
There was a problem hiding this comment.
Apologies for the back and forth. This line is needed here
There was a problem hiding this comment.
No worries. Added back.
website/docs/r/subnet.html.markdown
Outdated
|
|
||
| -> **Note:** When configuring Azure Private Link service, the explicit setting `private_link_service_network_policies_enabled` must be set to `false` in the subnet since Private Link Service does not support network policies like user-defined Routes and Network Security Groups. This setting only affects the Private Link service. For other resources in the subnet, access is controlled based on the Network Security Group which can be configured using the `azurerm_subnet_network_security_group_association` resource. See more details from [Manage network policies for Private Link Services](https://learn.microsoft.com/en-gb/azure/private-link/disable-private-link-service-network-policy?tabs=private-link-network-policy-powershell). | ||
|
|
||
| * `sharing_scope` - (Optional) The sharing scope of the subnet. Possible value is `Tenant`. This property cannot be set if `default_outbound_access_enabled` is set to `true`. |
There was a problem hiding this comment.
| * `sharing_scope` - (Optional) The sharing scope of the subnet. Possible value is `Tenant`. This property cannot be set if `default_outbound_access_enabled` is set to `true`. | |
| * `sharing_scope` - (Optional) The sharing scope of the subnet. Possible value is `Tenant`. | |
| ~> **Note:** This property cannot be set if `default_outbound_access_enabled` is set to `true`. |
There was a problem hiding this comment.
Updated. Thanks.
| }) | ||
| } | ||
|
|
||
| func TestAccSubnet_sharingScope(t *testing.T) { |
There was a problem hiding this comment.
This test can be removed as it's captured by TestAccSubnet_sharingScopeUpdated
There was a problem hiding this comment.
Updated. Thanks
| "sharing_scope": { | ||
| Type: pluginsdk.TypeString, | ||
| Optional: true, | ||
| // now only "Tenant" is supported, "DelegatedServices" is not supported, https://github.com/Azure/azure-rest-api-specs/issues/36446 |
There was a problem hiding this comment.
| // now only "Tenant" is supported, "DelegatedServices" is not supported, https://github.com/Azure/azure-rest-api-specs/issues/36446 | |
| // todo "Tenant" is only supported until https://github.com/Azure/azure-rest-api-specs/issues/36446 is addressed |
There was a problem hiding this comment.
Updated. Thanks.
|
Hi @mbfrahry , thanks for the review. I have updated the code and doc. Kindly help take another look.
|
|
Hi @mbfrahry, I have added the |
azurerm_subnet - support sharing_scope propertyazurerm_subnet - add support for sharing_scope
|
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. |


Community Note
Description
re-submit PR for PR 30316. Changes are:
NotesdocPR Checklist
For example: “
resource_name_here- description of change e.g. adding propertynew_property_name_here”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_subnet- supportsharing_scopepropertyThis is a (please select all that apply):
Related Issue(s)
Fixes #0000
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the provider.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Note
If this PR changes meaningfully during the course of review please update the title and description as required.