Skip to content

Commit 5409e63

Browse files
authored
Merge pull request #1 from kolosovpetro/AZ400-222
AZ400-222
2 parents 0c8f8f9 + bc2e916 commit 5409e63

File tree

76 files changed

+2576
-1140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2576
-1140
lines changed

.config/terraform-docs.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.config/tflint.hcl

Lines changed: 0 additions & 66 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@
66
*.tfstate
77
*.lock.info
88
*.tfstate.backup
9-
*.lock.hcl
10-
*.variables.json

.pre-commit-config.yaml

Lines changed: 0 additions & 32 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html).
7+
8+
## v1.1.0 - In Progress
9+
10+
### Changed
11+
12+
- Windows 2022 base image for `windows-server2022-v4.pkr.hcl`
13+
- Windows 2019 base image for `windows-server2019-v4.pkr.hcl`
14+
- Verifies image Windows Server images integrity using `scf scan` and `DISM`
15+
- Configures WinRM for Ansible as part of images
16+
- Images are tested using Terraform
17+
- Add encoding fix PowerShell script (removes BOM and fixes EOL)
18+
- Arrange images folder structure for better code maintainability
19+
- Each image contains `README` file with complete guide how to build it
20+
- Add PowerShell script for Packer init and validate images
21+
22+
**Installed software v4**
23+
24+
- azure-cli
25+
- microsoft-edge
26+
- git
27+
- netfx-4.8-devpack
28+
- dotnet-6.0-sdk
29+
- powershell-core
30+
- winrar
31+
- notepadplusplus
32+
- sql-server-management-studio
33+
- azcopy10
34+
35+
## v1.0.0 - In Progress
36+
37+
### Changed
38+
39+
- azure-cli
40+
- microsoft-edge
41+
- git
42+
- netfx-4.8-devpack
43+
- dotnet-6.0-sdk
44+
- openssl
45+
- powershell-core
46+
- winrar
47+
- notepadplusplus
48+
- nvm

README.md

Lines changed: 31 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,33 @@
11
# Packer Azure Windows Image
22

3-
Example of how to create and deploy Azure Windows VM with preinstalled chocolatey and other software
4-
5-
### To install Packer
6-
7-
- `choco install packer -y`
8-
9-
### Packer commands
10-
11-
- `packer init windows-server2019-v1.pkr.hcl`
12-
- `packer validate -var-file="windows.variables.json" windows-server2019-v1.pkr.hcl`
13-
- `packer build -var-file="windows.variables.json" windows-server2019-v1.pkr.hcl`
14-
15-
## Pre-commit configuration
16-
17-
- Install python3 via windows store
18-
- `pip install --upgrade pip`
19-
- `pip install pre-commit`
20-
- Update PATH variable
21-
- `pre-commit install`
22-
23-
## Install terraform docs
24-
25-
- `choco install terraform-docs`
26-
27-
## Install tflint
28-
29-
- `choco install tflint`
30-
31-
## Documentation
32-
33-
- https://github.com/antonbabenko/pre-commit-terraform
34-
- https://github.com/kolosovpetro/AzureTerraformBackend
35-
- https://github.com/terraform-docs/terraform-docs
36-
- https://terraform-docs.io/user-guide/installation/
37-
- https://pre-commit.com/
38-
39-
## Storage account configuration file
40-
41-
```bash
42-
storage_account_name = "storage_account_name"
43-
container_name = "container_name"
44-
key = "terraform.tfstate"
45-
sas_token = "sas_token"
46-
```
47-
48-
## Deploy storage account for terraform state
49-
50-
- See [CreateAzureStorageAccount.ps1](./CreateAzureStorageAccount.ps1)
51-
52-
# Module documentation
53-
54-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
55-
## Requirements
56-
57-
| Name | Version |
58-
|------|---------|
59-
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | =3.71.0 |
60-
61-
## Providers
62-
63-
| Name | Version |
64-
|------|---------|
65-
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.71.0 |
66-
67-
## Modules
68-
69-
| Name | Source | Version |
70-
|------|--------|---------|
71-
| <a name="module_custom_script_extension"></a> [custom\_script\_extension](#module\_custom\_script\_extension) | ./modules/custom-script-extension | n/a |
72-
| <a name="module_key_vault"></a> [key\_vault](#module\_key\_vault) | ./modules/keyvault | n/a |
73-
| <a name="module_key_vault_secrets"></a> [key\_vault\_secrets](#module\_key\_vault\_secrets) | ./modules/keyvault-secrets | n/a |
74-
| <a name="module_keyvault_access_policy"></a> [keyvault\_access\_policy](#module\_keyvault\_access\_policy) | ./modules/keyvault-access-policy | n/a |
75-
| <a name="module_network"></a> [network](#module\_network) | ./modules/network | n/a |
76-
| <a name="module_storage"></a> [storage](#module\_storage) | ./modules/storage | n/a |
77-
| <a name="module_virtual_machine"></a> [virtual\_machine](#module\_virtual\_machine) | ./modules/vm | n/a |
78-
79-
## Resources
80-
81-
| Name | Type |
82-
|------|------|
83-
| [azurerm_resource_group.public](https://registry.terraform.io/providers/hashicorp/azurerm/3.71.0/docs/resources/resource_group) | resource |
84-
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/3.71.0/docs/data-sources/client_config) | data source |
85-
86-
## Inputs
87-
88-
| Name | Description | Type | Default | Required |
89-
|------|-------------|------|---------|:--------:|
90-
| <a name="input_azure-client-id"></a> [azure-client-id](#input\_azure-client-id) | n/a | `string` | n/a | yes |
91-
| <a name="input_azure-client-secret"></a> [azure-client-secret](#input\_azure-client-secret) | n/a | `string` | n/a | yes |
92-
| <a name="input_azure-region"></a> [azure-region](#input\_azure-region) | n/a | `string` | n/a | yes |
93-
| <a name="input_azure-resource-group"></a> [azure-resource-group](#input\_azure-resource-group) | n/a | `string` | n/a | yes |
94-
| <a name="input_azure-subscription-id"></a> [azure-subscription-id](#input\_azure-subscription-id) | n/a | `string` | n/a | yes |
95-
| <a name="input_azure-tenant-id"></a> [azure-tenant-id](#input\_azure-tenant-id) | n/a | `string` | n/a | yes |
96-
| <a name="input_custom_script_extension_enabled"></a> [custom\_script\_extension\_enabled](#input\_custom\_script\_extension\_enabled) | Specifies whether the extension should be enabled or disabled. | `bool` | n/a | yes |
97-
| <a name="input_image-name"></a> [image-name](#input\_image-name) | n/a | `string` | n/a | yes |
98-
| <a name="input_image_resource_group_name"></a> [image\_resource\_group\_name](#input\_image\_resource\_group\_name) | Specifies the name of the resource group that contains the image to use to create the virtual machine. | `string` | n/a | yes |
99-
| <a name="input_os_profile_admin_password"></a> [os\_profile\_admin\_password](#input\_os\_profile\_admin\_password) | Specifies the password of the administrator account. | `string` | n/a | yes |
100-
| <a name="input_os_profile_admin_username"></a> [os\_profile\_admin\_username](#input\_os\_profile\_admin\_username) | Specifies the name of the administrator account. | `string` | n/a | yes |
101-
| <a name="input_prefix"></a> [prefix](#input\_prefix) | Resources name prefix | `string` | n/a | yes |
102-
| <a name="input_resource_group_location"></a> [resource\_group\_location](#input\_resource\_group\_location) | Location of the resource group. | `string` | n/a | yes |
103-
| <a name="input_storage_account_replication"></a> [storage\_account\_replication](#input\_storage\_account\_replication) | Specifies the replication type for this storage account. | `string` | n/a | yes |
104-
| <a name="input_storage_account_tier"></a> [storage\_account\_tier](#input\_storage\_account\_tier) | Specifies the tier to use for this storage account. | `string` | n/a | yes |
105-
| <a name="input_storage_image_reference_offer"></a> [storage\_image\_reference\_offer](#input\_storage\_image\_reference\_offer) | Specifies the offer of the platform image or marketplace image used to create the virtual machine. | `string` | n/a | yes |
106-
| <a name="input_storage_image_reference_publisher"></a> [storage\_image\_reference\_publisher](#input\_storage\_image\_reference\_publisher) | The publisher of the image used to create the virtual machine. | `string` | n/a | yes |
107-
| <a name="input_storage_image_reference_sku"></a> [storage\_image\_reference\_sku](#input\_storage\_image\_reference\_sku) | Specifies the SKU of the platform image or marketplace image used to create the virtual machine. | `string` | n/a | yes |
108-
| <a name="input_storage_image_reference_version"></a> [storage\_image\_reference\_version](#input\_storage\_image\_reference\_version) | Specifies the version of the platform image or marketplace image used to create the virtual machine. | `string` | n/a | yes |
109-
| <a name="input_storage_os_disk_caching"></a> [storage\_os\_disk\_caching](#input\_storage\_os\_disk\_caching) | Specifies the caching requirements for the OS disk. | `string` | n/a | yes |
110-
| <a name="input_storage_os_disk_create_option"></a> [storage\_os\_disk\_create\_option](#input\_storage\_os\_disk\_create\_option) | Specifies how the virtual machine should be created. | `string` | n/a | yes |
111-
| <a name="input_storage_os_disk_managed_disk_type"></a> [storage\_os\_disk\_managed\_disk\_type](#input\_storage\_os\_disk\_managed\_disk\_type) | Specifies the storage account type for the managed disk. | `string` | n/a | yes |
112-
| <a name="input_vm-size"></a> [vm-size](#input\_vm-size) | n/a | `string` | n/a | yes |
113-
| <a name="input_vm_size"></a> [vm\_size](#input\_vm\_size) | The size of the virtual machine. | `string` | n/a | yes |
114-
115-
## Outputs
116-
117-
| Name | Description |
118-
|------|-------------|
119-
| <a name="output_public_ip"></a> [public\_ip](#output\_public\_ip) | n/a |
120-
| <a name="output_username"></a> [username](#output\_username) | n/a |
121-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
3+
Packer-based automation for building Azure Windows Server images. Supports Windows Server 2019 & 2022 with pre-installed
4+
tools like Azure CLI, PowerShell Core, and SQL Server Management Studio. Ensures integrity with scf scan & DISM,
5+
configures WinRM for Ansible, and validates images with Terraform.
6+
7+
## Provisioners used
8+
9+
- https://github.com/hashicorp/packer-plugin-azure
10+
- https://github.com/rgl/packer-plugin-windows-update
11+
12+
## Installed software v4
13+
14+
- azure-cli
15+
- microsoft-edge
16+
- git
17+
- netfx-4.8-devpack
18+
- dotnet-6.0-sdk
19+
- powershell-core
20+
- winrar
21+
- notepadplusplus
22+
- sql-server-management-studio
23+
- azcopy10
24+
25+
## Terraform modules in this repository
26+
27+
- custom-script-extension
28+
- vm
29+
- storage
30+
- network
31+
- keyvault-secrets
32+
- keyvault-access-policy
33+
- keyvault

0 commit comments

Comments
 (0)