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_bastion_host - adding property kerberos_enabled #25823

Merged
merged 5 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions internal/services/network/bastion_host_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ func resourceBastionHost() *pluginsdk.Resource {
Default: false,
},

"kerberos_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
},

"scale_units": {
Type: pluginsdk.TypeInt,
Optional: true,
Expand Down Expand Up @@ -171,6 +177,7 @@ func resourceBastionHostCreateUpdate(d *pluginsdk.ResourceData, meta interface{}
sku := d.Get("sku").(string)
fileCopyEnabled := d.Get("file_copy_enabled").(bool)
ipConnectEnabled := d.Get("ip_connect_enabled").(bool)
kerberosEnabled := d.Get("kerberos_enabled").(bool)
shareableLinkEnabled := d.Get("shareable_link_enabled").(bool)
tunnelingEnabled := d.Get("tunneling_enabled").(bool)

Expand All @@ -186,6 +193,10 @@ func resourceBastionHostCreateUpdate(d *pluginsdk.ResourceData, meta interface{}
return fmt.Errorf("`ip_connect_enabled` is only supported when `sku` is `Standard`")
}

if kerberosEnabled && sku == string(bastionhosts.BastionHostSkuNameBasic) {
return fmt.Errorf("`kerberos_enabled` is only supported when `sku` is `Standard`")
}

if shareableLinkEnabled && sku == string(bastionhosts.BastionHostSkuNameBasic) {
return fmt.Errorf("`shareable_link_enabled` is only supported when `sku` is `Standard`")
}
Expand Down Expand Up @@ -213,6 +224,7 @@ func resourceBastionHostCreateUpdate(d *pluginsdk.ResourceData, meta interface{}
DisableCopyPaste: utils.Bool(!d.Get("copy_paste_enabled").(bool)),
EnableFileCopy: utils.Bool(fileCopyEnabled),
EnableIPConnect: utils.Bool(ipConnectEnabled),
EnableKerberos: utils.Bool(kerberosEnabled),
EnableShareableLink: utils.Bool(shareableLinkEnabled),
EnableTunneling: utils.Bool(tunnelingEnabled),
IPConfigurations: expandBastionHostIPConfiguration(d.Get("ip_configuration").([]interface{})),
Expand Down Expand Up @@ -270,6 +282,7 @@ func resourceBastionHostRead(d *pluginsdk.ResourceData, meta interface{}) error
d.Set("scale_units", props.ScaleUnits)
d.Set("file_copy_enabled", props.EnableFileCopy)
d.Set("ip_connect_enabled", props.EnableIPConnect)
d.Set("kerberos_enabled", props.EnableKerberos)
d.Set("shareable_link_enabled", props.EnableShareableLink)
d.Set("tunneling_enabled", props.EnableTunneling)

Expand Down
1 change: 1 addition & 0 deletions internal/services/network/bastion_host_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ resource "azurerm_bastion_host" "test" {
sku = "Standard"
file_copy_enabled = true
ip_connect_enabled = true
kerberos_enabled = true
shareable_link_enabled = true
tunneling_enabled = true

Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/bastion_host.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ The following arguments are supported:

~> **Note:** `ip_connect_enabled` is only supported when `sku` is `Standard`.

* `kerberos_enabled` - (Optional) Is Kerberos authentication feature enabled for the Bastion Host. Defaults to `false`.

~> **Note:** `kerberos_enabled` is only supported when `sku` is `Standard`.

* `scale_units` - (Optional) The number of scale units with which to provision the Bastion Host. Possible values are between `2` and `50`. Defaults to `2`.

~> **Note:** `scale_units` only can be changed when `sku` is `Standard`. `scale_units` is always `2` when `sku` is `Basic`.
Expand Down