💡
This resource is automatically created by the windows-computer, and cannot be destroyed.
Terraform's "Create" lifecycle-method imports the resource, saves the imported state so it can be reinstated at a later time, and updates the resource based on the attributes in the Terraform configuration.
Terraform's "Destroy" lifecycle-method reinstates the originally imported state.
resource "windows_computer" "my_computer_1" {
dns_client {
suffix_search_list = [ "local" ]
enable_devolution = true
devolution_level = 0
}
}
output "my_computer_1_name" {
value = windows_computer.my_computer_1.name
}
resource "windows_computer" "my_computer_2" {
new_name = "MY-COMPUTER"
}
output "my_computer_2_name" {
value = windows_computer.my_computer_2.name
}
output "my_computer_2_reboot_pending" {
value = windows_computer.my_computer_2.reboot_pending
}
output "my_computer_2_rename_pending" {
value = windows_computer.my_computer_2.reboot_pending_details[0].computer_rename_pending
}
-
new_name
- (string, Optional) - The new name of the windows-computer. When this is different from the current name, then the exportedreboot_pending
attribute andcomputer_rename_pending
attribute inreboot_pending_details
will be set totrue
. The new name will only become effective after a reboot of the windows computer. -
dns_client
- (resource, Optional)-
suffix_search_list
- (list[string], Optional) - Specifies a list of global suffixes that can be used in the specified order by the DNS client for resolving the IP address of the computer name. These suffixes are appended in the specified order to resolve the computer name that is specified. This attribute cannot be set if the suffix search list setting is already deployed through Group Policy. -
enable_devolution
- (boolean, Optional) - Indicates whether devolution is activated. With devolution, the DNS resolver creates new FQDNs by appending the single-label, unqualified domain name with the parent suffix of the primary DNS suffix name, and the parent of that suffix, and so on, stopping if the name is successfully resolved or at a level specified in thedevolution_level
attribute. Devolution works by removing the left-most label and continuing to get to the parent suffix. This attribute cannot be set if the devolution level setting is already deployed through Group Policy. -
devolution_level
- (integer, Optional) - Specifies the number of labels up to which devolution should occur. The devolution level is an integer between0
and4,294,967,295
. If this attribute is0
, then the FRD algorithm is used. If this attribute is greater than0
, then devolution occurs until the specified level. This attribute cannot be set if the devolution level setting is already deployed through Group Policy.
-
{
"name": "MY-COMPUTER",
"new_name": "MY-COMPUTER",
"dns_client": [{
"suffix_search_list": [ "local" ],
"enable_devolution": true,
"devolution_level": 0,
}],
"reboot_pending": false,
"reboot_pending_details": [{
"computer_rename_pending": false,
"current_reboot_attemps": false,
"dvd_reboot_signal": false,
"file_rename_pending": false,
"netlogon_pending": false,
"packages_pending": false,
"post_reboot_reporting": false,
"reboot_in_progress": false,
"reboot_pending": false,
"reboot_required": false,
"services_pending": false,
"update_exe_volatile": false
}]
}
In addition to the argument attributes:
-
name
- (string) - The name of the windows-computer. -
reboot_pending
- (boolean) - The windows-computer is waiting for a reboot. -
reboot_pending_details
- (resource) - The reason forreboot_pending
.-
computer_rename_pending
- (boolean) - The windows-computer is waiting for a reboot because it was given a new name. -
Other attributes are outside the scope of this documentation. They refer to Windows registry items - see tables below. For more information, please refer to the Windows documentation
-
To help with debugging, the following provides an overview of where the attributes can be found, using shell commands.
attribute | command |
---|---|
name |
$env:ComputerName |
new_name |
( Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName' -Name 'ComputerName' ).ComputerName |
dns_client |
|
- suffix_search_list |
( Get-DnsClientGlobalSetting ).SuffixSearchList |
- enable_devolution |
( Get-DnsClientGlobalSetting ).UseDevolution |
- devolution_level |
( Get-DnsClientGlobalSetting ).DevolutionLevel |
reboot_pending |
see table below |
reboot_pending_details |
see table below |
attribute | key, condition for true value |
---|---|
computer_rename_pending |
HKLM:\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName , ComputerName value not equal to $env:ComputerName |
current_reboot_attemps |
HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts , key exist |
dvd_reboot_signal |
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce , DVDRebootSignal value exists |
file_rename_pending |
HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager , PendingFileRenameOperations value exists or PendingFileRenameOperations2 value exists |
netlogon_pending |
HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon , JoinDomain value exists or AvoidSpnSet value exists |
packages_pending |
HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackagesPending , key exist |
post_reboot_reporting |
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting , key exists |
reboot_in_progress |
HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootInProgress , key exist |
reboot_pending |
HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending , key exist |
reboot_required |
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired , key exists |
services_pending |
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Services\Pending , any GUID subkeys exist |
update_exe_volatile |
HKLM:\SOFTWARE\Microsoft\Updates , UpdateExeVolatile value not equal to 0 |