-
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_virtual_network
: support encryption
#22745
Conversation
wuxu92
commented
Jul 31, 2023
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.
hi @wuxu92
Thanks for this PR - I've taken a look through and left some comments inline, if we can address those then we should be able to take another look.
Thanks!
"enabled": { | ||
Type: pluginsdk.TypeBool, | ||
Required: true, | ||
}, |
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.
we don't expose the enabled
field, since this can be tracked by the presence of the block - can we remove this field (and make unencrypted_allowed
required, since it'll be the only inner field)?
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.
updated
@@ -430,6 +467,21 @@ func flattenVirtualNetworkDDoSProtectionPlan(input *network.VirtualNetworkProper | |||
} | |||
} | |||
|
|||
func flattenVirtualNetworkEncryption(encryption *network.VirtualNetworkEncryption) interface{} { | |||
if encryption == nil { | |||
return nil |
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.
this means we won't be outputting this correctly
return nil | |
return make([]interface{}, 0) |
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.
updated
|
||
* `enabled` - (Required) Enable/disable encryption on Virtual Network. | ||
|
||
* `unencrypted_allowed` - (Optional) Whether ths virtual network allos VM that does not support encryption. value `false` for `DropUnencrypted`. value `true` for `AllowUnencrypted`. Defaults to `false`. |
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.
We should expose this as the string constant, not as a boolean, since it's likely other values will get added here in the future
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.
thanks! document updated.
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.
LGTM ☔
if vList := v.([]interface{}); len(vList) > 0 && vList[0] != nil { | ||
encryptionConf := vList[0].(map[string]interface{}) | ||
properties.Encryption = &network.VirtualNetworkEncryption{ | ||
Enabled: pointer.To(true), | ||
Enforcement: network.VirtualNetworkEncryptionEnforcement(encryptionConf["enforcement"].(string)), | ||
} | ||
} |
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.
@wuxu92 how would users remove this value? We'd need to send Encryption.enabled = false
when len(vList) == 0
?
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.
the update method will set the Encryption.Enabled
to false when leave the Encryption
block as null(not set).
and I submitted a PR to update the acctest for this case: #22807.
so users can just remove the encryption block in terraform configuration, then it will be set to false automatically.
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. |