Merge pull request #3020 from davemcdermid/azure-join-domain
Added join_domain feature to Azure Instance resource
This commit is contained in:
commit
6cf126defa
|
@ -170,6 +170,30 @@ func resourceAzureInstance() *schema.Resource {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"domain_name": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
"domain_username": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
"domain_password": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
"domain_ou": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
ForceNew: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -273,6 +297,19 @@ func resourceAzureInstanceCreate(d *schema.ResourceData, meta interface{}) (err
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error configuring %s for Windows: %s", name, err)
|
return fmt.Errorf("Error configuring %s for Windows: %s", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if domain_name, ok := d.GetOk("domain_name"); ok {
|
||||||
|
err = vmutils.ConfigureWindowsToJoinDomain(
|
||||||
|
&role,
|
||||||
|
d.Get("domain_username").(string),
|
||||||
|
d.Get("domain_password").(string),
|
||||||
|
domain_name.(string),
|
||||||
|
d.Get("domain_ou").(string),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error configuring %s for WindowsToJoinDomain: %s", name, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if s := d.Get("endpoint").(*schema.Set); s.Len() > 0 {
|
if s := d.Get("endpoint").(*schema.Set); s.Len() > 0 {
|
||||||
|
|
|
@ -31,6 +31,10 @@ resource "azure_instance" "web" {
|
||||||
location = "West US"
|
location = "West US"
|
||||||
username = "terraform"
|
username = "terraform"
|
||||||
password = "Pass!admin123"
|
password = "Pass!admin123"
|
||||||
|
domain_name = "contoso.com"
|
||||||
|
domain_ou = "OU=Servers,DC=contoso.com,DC=Contoso,DC=com"
|
||||||
|
domain_username = "Administrator"
|
||||||
|
domain_password = "Pa$$word123"
|
||||||
|
|
||||||
endpoint {
|
endpoint {
|
||||||
name = "SSH"
|
name = "SSH"
|
||||||
|
@ -109,6 +113,18 @@ The following arguments are supported:
|
||||||
* `endpoint` - (Optional) Can be specified multiple times to define multiple
|
* `endpoint` - (Optional) Can be specified multiple times to define multiple
|
||||||
endpoints. Each `endpoint` block supports fields documented below.
|
endpoints. Each `endpoint` block supports fields documented below.
|
||||||
|
|
||||||
|
* `domain_name` - (Optional) The name of an Active Directory domain to join.
|
||||||
|
|
||||||
|
* `domain_ou` - (Optional) Specifies the LDAP Organisational Unit to place the
|
||||||
|
instance in.
|
||||||
|
|
||||||
|
* `domain_username` - (Optional) The username of an account with permission to
|
||||||
|
join the instance to the domain. Required if a domain_name is specified.
|
||||||
|
|
||||||
|
* `domain_password` - (Optional) The password for the domain_username account
|
||||||
|
specified above.
|
||||||
|
|
||||||
|
|
||||||
The `endpoint` block supports:
|
The `endpoint` block supports:
|
||||||
|
|
||||||
* `name` - (Required) The name of the external endpoint.
|
* `name` - (Required) The name of the external endpoint.
|
||||||
|
|
Loading…
Reference in New Issue