Skip to content

Commit 60e80ae

Browse files
author
Peter Pouliot
committed
README.md_changes
1 parent a73356b commit 60e80ae

File tree

1 file changed

+8
-320
lines changed

1 file changed

+8
-320
lines changed

README.md

Lines changed: 8 additions & 320 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818

1919
## Description
2020

21-
Terraform code to launch a Ampere virtual machines on Microsoft Azure.
21+
OpenTofu/Terraform code to launch a Ampere virtual machines on Microsoft Azure.
2222

2323
## Requirements
2424

2525
* [Terraform](https://www.terraform.io/downloads.html)
2626
* [Microsoft Azure Account](https://azure.microsoft.com/en-us/)
2727
* [Microsoft Azure CLI](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/azure_cli)
2828

29-
## What exactly is Terraform doing
29+
## What exactly is OpenTofu/Terraform doing
3030

3131
The goal of this code is to supply the minimal ammount of information to quickly have working Ampere virtual machines on ["Azure"](https://azure.microsoft.com/en-us/).
3232
Virtual machines are configured with a simple cloud-config using the Azure metadata provider APIs.
@@ -52,333 +52,21 @@ tenant_id = "87654321-dcba-4321-dcba-ba0987654321"
5252
```
5353
### Using as a Module
5454

55-
This can also be used as a terraform module. The [examples](examples) directory contains example code for module usage showing different operating systems booting with a custom cloud-init templates. Doing a clone of this repository and changing directory to one of the examples, placing a terraform.tfvars into that directory, and running a typical terrafornm workflow will produce a working virtual machine in the os that was specified in the main.tf that is located within the chosen example directory.
55+
This can also be used as a OpenTofu or Terraform module. The [examples](examples) directory contains example code for module usage showing different operating systems booting with a custom cloud-init templates. Doing a clone of this repository and changing directory to one of the examples, placing a terraform.tfvars into that directory, and running a typical terrafornm workflow will produce a working virtual machine in the os that was specified in the main.tf that is located within the chosen example directory.
5656

57-
### Running Terraform
57+
### Running using OpenTofu
5858

5959
```
60-
terraform init && terraform plan && terraform apply -auto-approve
61-
```
62-
63-
<!-- BEGIN_TF_DOCS -->
64-
65-
66-
67-
## Examples
68-
69-
### AlmaLinux 8
70-
71-
```hcl
72-
variable "subscription_id" {}
73-
variable "tenant_id" {}
74-
75-
locals {
76-
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
77-
}
78-
79-
module "azure-ampere-vm" {
80-
source = "github.com/amperecomputing/terraform-azure-ampere-vm"
81-
subscription_id = var.subscription_id
82-
tenant_id = var.tenant_id
83-
# Optional
84-
# resource_group = var.resource_group
85-
# rg_prefix = var.rg_prefix
86-
# virtual_network_name = var.virtual_network_name
87-
# address_space = var.address_space
88-
# subnet_prefix = var.subnet_prefix
89-
# vm_size = var.vm_size
90-
location = "westus2"
91-
azure_vm_count = 1
92-
azure_os_image = "almalinux8"
93-
instance_prefix = "azure-ampere-vm-almalinux8"
94-
cloud_init_template_file = local.cloud_init_template_path
95-
}
96-
97-
output "azure_ampere_vm_private_ips" {
98-
value = module.azure-ampere-vm.azure_ampere_vm_private_ipaddresses
99-
}
100-
output "azure_ampere_vm_public_ips" {
101-
value = module.azure-ampere-vm.azure_ampere_vm_public_ipaddresses
102-
}
60+
tofu init && tofu plan && tofu apply -auto-approve
10361
```
10462

105-
### Debian 11
106-
107-
```hcl
108-
variable "subscription_id" {}
109-
variable "tenant_id" {}
110-
111-
locals {
112-
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
113-
}
114-
115-
module "azure-ampere-vm" {
116-
source = "github.com/amperecomputing/terraform-azure-ampere-vm"
117-
subscription_id = var.subscription_id
118-
tenant_id = var.tenant_id
119-
# Optional
120-
# resource_group = var.resource_group
121-
# rg_prefix = var.rg_prefix
122-
# virtual_network_name = var.virtual_network_name
123-
# address_space = var.address_space
124-
# subnet_prefix = var.subnet_prefix
125-
# vm_size = var.vm_size
126-
location = "westus2"
127-
azure_vm_count = 1
128-
azure_os_image = "debian11"
129-
instance_prefix = "azure-ampere-vm-debian-11"
130-
cloud_init_template_file = local.cloud_init_template_path
131-
}
132-
133-
output "azure_ampere_vm_private_ips" {
134-
value = module.azure-ampere-vm.azure_ampere_vm_private_ipaddresses
135-
}
136-
output "azure_ampere_vm_public_ips" {
137-
value = module.azure-ampere-vm.azure_ampere_vm_public_ipaddresses
138-
}
139-
```
140-
141-
### CBL Mariner
142-
143-
```hcl
144-
variable "subscription_id" {}
145-
variable "tenant_id" {}
146-
147-
locals {
148-
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
149-
}
150-
151-
module "azure-ampere-vm" {
152-
source = "github.com/amperecomputing/terraform-azure-ampere-vm"
153-
subscription_id = var.subscription_id
154-
tenant_id = var.tenant_id
155-
# Optional
156-
# resource_group = var.resource_group
157-
# rg_prefix = var.rg_prefix
158-
# virtual_network_name = var.virtual_network_name
159-
# address_space = var.address_space
160-
# subnet_prefix = var.subnet_prefix
161-
# vm_size = var.vm_size
162-
location = "westus2"
163-
azure_vm_count = 1
164-
azure_os_image = "mariner"
165-
instance_prefix = "azure-ampere-vm-mariner"
166-
cloud_init_template_file = local.cloud_init_template_path
167-
}
168-
169-
output "azure_ampere_vm_private_ips" {
170-
value = module.azure-ampere-vm.azure_ampere_vm_private_ipaddresses
171-
}
172-
output "azure_ampere_vm_public_ips" {
173-
value = module.azure-ampere-vm.azure_ampere_vm_public_ipaddresses
174-
}
175-
```
176-
177-
### OpenSuse
178-
179-
```hcl
180-
variable "subscription_id" {}
181-
variable "tenant_id" {}
182-
183-
locals {
184-
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
185-
}
186-
187-
module "azure-ampere-vm" {
188-
source = "github.com/amperecomputing/terraform-azure-ampere-vm"
189-
subscription_id = var.subscription_id
190-
tenant_id = var.tenant_id
191-
# Optional
192-
# resource_group = var.resource_group
193-
# rg_prefix = var.rg_prefix
194-
# virtual_network_name = var.virtual_network_name
195-
# address_space = var.address_space
196-
# subnet_prefix = var.subnet_prefix
197-
# vm_size = var.vm_size
198-
location = "westus2"
199-
azure_vm_count = 1
200-
azure_os_image = "opensuse"
201-
instance_prefix = "azure-ampere-vm-opensuse-15"
202-
cloud_init_template_file = local.cloud_init_template_path
203-
}
63+
### Running using Terraform
20464

205-
output "azure_ampere_vm_private_ips" {
206-
value = module.azure-ampere-vm.azure_ampere_vm_private_ipaddresses
207-
}
208-
output "azure_ampere_vm_public_ips" {
209-
value = module.azure-ampere-vm.azure_ampere_vm_public_ipaddresses
210-
}
21165
```
212-
213-
214-
### Example Ubuntu 18.04
215-
216-
```hcl
217-
variable "subscription_id" {}
218-
variable "tenant_id" {}
219-
220-
locals {
221-
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
222-
}
223-
224-
module "azure-ampere-vm" {
225-
source = "github.com/amperecomputing/terraform-azure-ampere-vm"
226-
subscription_id = var.subscription_id
227-
tenant_id = var.tenant_id
228-
# Optional
229-
# resource_group = var.resource_group
230-
# rg_prefix = var.rg_prefix
231-
# virtual_network_name = var.virtual_network_name
232-
# address_space = var.address_space
233-
# subnet_prefix = var.subnet_prefix
234-
# vm_size = var.vm_size
235-
location = "westus2"
236-
azure_vm_count = 1
237-
azure_os_image = "ubuntu1804"
238-
instance_prefix = "azure-ampere-vm-ubuntu-1804"
239-
cloud_init_template_file = local.cloud_init_template_path
240-
}
241-
242-
output "azure_ampere_vm_private_ips" {
243-
value = module.azure-ampere-vm.azure_ampere_vm_private_ipaddresses
244-
}
245-
output "azure_ampere_vm_public_ips" {
246-
value = module.azure-ampere-vm.azure_ampere_vm_public_ipaddresses
247-
}
248-
```
249-
250-
### Example Ubuntu 20.04
251-
252-
```hcl
253-
variable "subscription_id" {}
254-
variable "tenant_id" {}
255-
256-
locals {
257-
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
258-
}
259-
260-
module "azure-ampere-vm" {
261-
source = "github.com/amperecomputing/terraform-azure-ampere-vm"
262-
subscription_id = var.subscription_id
263-
tenant_id = var.tenant_id
264-
# Optional
265-
# resource_group = var.resource_group
266-
# rg_prefix = var.rg_prefix
267-
# virtual_network_name = var.virtual_network_name
268-
# address_space = var.address_space
269-
# subnet_prefix = var.subnet_prefix
270-
# vm_size = var.vm_size
271-
location = "westus2"
272-
azure_vm_count = 1
273-
azure_os_image = "ubuntu2004"
274-
instance_prefix = "azure-ampere-vm-ubuntu-2004"
275-
cloud_init_template_file = local.cloud_init_template_path
276-
}
277-
278-
output "azure_ampere_vm_private_ips" {
279-
value = module.azure-ampere-vm.azure_ampere_vm_private_ipaddresses
280-
}
281-
output "azure_ampere_vm_public_ips" {
282-
value = module.azure-ampere-vm.azure_ampere_vm_public_ipaddresses
283-
}
284-
```
285-
### Example Ubuntu 22.04
286-
287-
```hcl
288-
variable "subscription_id" {}
289-
variable "tenant_id" {}
290-
291-
locals {
292-
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
293-
}
294-
295-
module "azure-ampere-vm" {
296-
source = "github.com/amperecomputing/terraform-azure-ampere-vm"
297-
subscription_id = var.subscription_id
298-
tenant_id = var.tenant_id
299-
# Optional
300-
# resource_group = var.resource_group
301-
# rg_prefix = var.rg_prefix
302-
# virtual_network_name = var.virtual_network_name
303-
# address_space = var.address_space
304-
# subnet_prefix = var.subnet_prefix
305-
# vm_size = var.vm_size
306-
location = "westus2"
307-
azure_vm_count = 1
308-
azure_os_image = "ubuntu2204"
309-
instance_prefix = "azure-ampere-vm-ubuntu-2204"
310-
cloud_init_template_file = local.cloud_init_template_path
311-
}
312-
313-
output "azure_ampere_vm_private_ips" {
314-
value = module.azure-ampere-vm.azure_ampere_vm_private_ipaddresses
315-
}
316-
output "azure_ampere_vm_public_ips" {
317-
value = module.azure-ampere-vm.azure_ampere_vm_public_ipaddresses
318-
}
66+
terraform init && terraform plan && terraform apply -auto-approve
31967
```
32068

321-
## Inputs
322-
323-
| Name | Description | Type | Default | Required |
324-
|------|-------------|------|---------|:--------:|
325-
| <a name="input_address_space"></a> [address\_space](#input\_address\_space) | The address space that is used by the virtual network. You can supply more than one address space. Changing this forces a new resource to be created. | `string` | `"10.2.0.0/16"` | no |
326-
| <a name="input_azure_os_image"></a> [azure\_os\_image](#input\_azure\_os\_image) | Default OS Image From the Local Vars | `string` | `"ubuntu2004"` | no |
327-
| <a name="input_azure_vm_count"></a> [azure\_vm\_count](#input\_azure\_vm\_count) | Azure Ampere Virtual machine Config | `number` | `1` | no |
328-
| <a name="input_cloud_init_template_file"></a> [cloud\_init\_template\_file](#input\_cloud\_init\_template\_file) | Optional path for a cloud-init file | `string` | `null` | no |
329-
| <a name="input_instance_prefix"></a> [instance\_prefix](#input\_instance\_prefix) | Name prefix for vm instances | `string` | `"azure-ampere-vm"` | no |
330-
| <a name="input_location"></a> [location](#input\_location) | The location/region where the virtual network is created. Changing this forces a new resource to be created. | `string` | `"westus2"` | no |
331-
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | The name of the resource group in which to create the virtual network. | `string` | `"Terraform-Ampere-on-Azure"` | no |
332-
| <a name="input_rg_prefix"></a> [rg\_prefix](#input\_rg\_prefix) | The shortened abbreviation to represent your resource group that will go on the front of some resources. | `string` | `"rg"` | no |
333-
| <a name="input_subnet_prefix"></a> [subnet\_prefix](#input\_subnet\_prefix) | The address prefix to use for the subnet. | `string` | `"10.2.1.0/24"` | no |
334-
| <a name="input_subscription_id"></a> [subscription\_id](#input\_subscription\_id) | Azure Credentials | `string` | `"Azure Subscription ID"` | no |
335-
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map` | <pre>{<br/> "environment": "Public Cloud"<br/>}</pre> | no |
336-
| <a name="input_tenant_id"></a> [tenant\_id](#input\_tenant\_id) | n/a | `string` | `"Azure Tenant ID"` | no |
337-
| <a name="input_virtual_network_name"></a> [virtual\_network\_name](#input\_virtual\_network\_name) | The name for the virtual network. | `string` | `"vnet"` | no |
338-
| <a name="input_vm_size"></a> [vm\_size](#input\_vm\_size) | Specifies the size of the Azure Ampere virtual machine. | `string` | `"Standard_D16ps_v5"` | no |
339-
## Modules
340-
341-
No modules.
342-
## Outputs
343-
344-
| Name | Description |
345-
|------|-------------|
346-
| <a name="output_azure_ampere_vm_private_ipaddresses"></a> [azure\_ampere\_vm\_private\_ipaddresses](#output\_azure\_ampere\_vm\_private\_ipaddresses) | Output the Azure VM(s)) private/internal ip address |
347-
| <a name="output_azure_ampere_vm_public_ipaddresses"></a> [azure\_ampere\_vm\_public\_ipaddresses](#output\_azure\_ampere\_vm\_public\_ipaddresses) | Output the Azure VM(s)) public/external ip address |
348-
| <a name="output_azure_ampere_vm_ssh_private_key"></a> [azure\_ampere\_vm\_ssh\_private\_key](#output\_azure\_ampere\_vm\_ssh\_private\_key) | Output the Azure SSH private key |
349-
| <a name="output_azure_ampere_vm_ssh_public_key"></a> [azure\_ampere\_vm\_ssh\_public\_key](#output\_azure\_ampere\_vm\_ssh\_public\_key) | Output the Azure SSH public key |
350-
| <a name="output_azure_current_subscription_display_name"></a> [azure\_current\_subscription\_display\_name](#output\_azure\_current\_subscription\_display\_name) | Output the Display Name for the current Azure Subscription |
351-
| <a name="output_azure_ssh_private_key"></a> [azure\_ssh\_private\_key](#output\_azure\_ssh\_private\_key) | output the Azure SSH private key |
352-
| <a name="output_azure_ssh_pubic_key"></a> [azure\_ssh\_pubic\_key](#output\_azure\_ssh\_pubic\_key) | output the Azure SSH public key |
353-
| <a name="output_random_uuid"></a> [random\_uuid](#output\_random\_uuid) | Output: A randomly generated uuid |
354-
## Providers
355-
356-
| Name | Version |
357-
|------|---------|
358-
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | n/a |
359-
| <a name="provider_local"></a> [local](#provider\_local) | n/a |
360-
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
361-
| <a name="provider_tls"></a> [tls](#provider\_tls) | n/a |
362-
## Resources
363-
364-
| Name | Type |
365-
|------|------|
366-
| [azurerm_network_interface.nic](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface) | resource |
367-
| [azurerm_network_security_group.nsg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_security_group) | resource |
368-
| [azurerm_public_ip.pip](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) | resource |
369-
| [azurerm_resource_group.rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource |
370-
| [azurerm_subnet.subnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet) | resource |
371-
| [azurerm_virtual_machine.vm](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine) | resource |
372-
| [azurerm_virtual_network.vnet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network) | resource |
373-
| [local_file.azure-ssh-privkey](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource |
374-
| [local_file.azure-ssh-pubkey](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource |
375-
| [random_uuid.random_id](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) | resource |
376-
| [tls_private_key.azure](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource |
377-
| [azurerm_public_ip.pip](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/public_ip) | data source |
378-
| [azurerm_subscription.current](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/subscription) | data source |
379-
## Requirements
380-
381-
No requirements.
69+
<!-- BEGIN_TF_DOCS -->
38270
<!-- END_TF_DOCS -->
38371

38472
## References

0 commit comments

Comments
 (0)