Skip to content

Commit

Permalink
azurerm_data_factory_linked_service_sftp: support for hostkey relat…
Browse files Browse the repository at this point in the history
…ed properties (#11825)

* `azurerm_data_factory_linked_service_sftp`: Add hostkey attributes

Add `skip_host_key_validateion` and `host_key_fingerprint` arguments.

Fixes #11797

* Remove default value

* Update website/docs/r/data_factory_linked_service_sftp.html.markdown

Co-authored-by: magodo <[email protected]>

* Address feedback, nilchecking

Co-authored-by: magodo <[email protected]>
  • Loading branch information
favoretti and magodo authored May 24, 2021
1 parent bb3af77 commit 3007cfd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ func resourceDataFactoryLinkedServiceSFTP() *schema.Resource {
},
},

"skip_host_key_validation": {
Type: schema.TypeBool,
Optional: true,
},

"host_key_fingerprint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"annotations": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -164,6 +175,8 @@ func resourceDataFactoryLinkedServiceSFTPCreateUpdate(d *schema.ResourceData, me
Password: &passwordSecureString,
}

sftpProperties.SkipHostKeyValidation = d.Get("skip_host_key_validation").(bool)
sftpProperties.HostKeyFingerprint = d.Get("host_key_fingerprint").(string)
description := d.Get("description").(string)

sftpLinkedService := &datafactory.SftpServerLinkedService{
Expand Down Expand Up @@ -264,6 +277,16 @@ func resourceDataFactoryLinkedServiceSFTPRead(d *schema.ResourceData, meta inter
}
}

if props := sftp.SftpServerLinkedServiceTypeProperties; props != nil {
if skipHostKeyValidation := props.SkipHostKeyValidation; skipHostKeyValidation != nil {
d.Set("skip_host_key_validation", skipHostKeyValidation.(bool))
}

if hostKeyFingerprint := props.HostKeyFingerprint; hostKeyFingerprint != nil {
d.Set("host_key_fingerprint", hostKeyFingerprint)
}
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/data_factory_linked_service_sftp.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ The following supported arguments are specific to SFTP Linked Service:

* `password` - (Required) Password to logon to the SFTP Server for Basic Authentication.

* `host_key_fingerprint` - (Optional) The host key fingerprint of the SFTP server.

* `skip_host_key_validation` - (Optional) Whether to validate host key fingerprint while connecting. If set to `false`, `host_key_fingerprint` must also be set.

## Attributes Reference

The following attributes are exported:
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/static_site.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ Static Web Apps can be imported using the `resource id`, e.g.

```shell
terraform import azurerm_static_site.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Web/staticSites/my-static-site1
```
```

0 comments on commit 3007cfd

Please sign in to comment.