diff --git a/modules/vsphere/datacenter/README.md b/modules/vsphere/datacenter/README.md new file mode 100755 index 00000000..80552dcc --- /dev/null +++ b/modules/vsphere/datacenter/README.md @@ -0,0 +1,166 @@ + + + + + + + +[![Contributors][contributors-shield]][contributors-url] +[![Forks][forks-shield]][forks-url] +[![Stargazers][stars-shield]][stars-url] +[![Issues][issues-shield]][issues-url] +[![MIT License][license-shield]][license-url] +[![LinkedIn][linkedin-shield]][linkedin-url] + + + +
+
+ + Logo + + +

Datacenter

+

+ The vSphere Datacenter module deploys a datacenter resource. +
+ Explore the docs » +
+
+ Zachary Hill + · + Report Bug + · + Request Feature +

+
+ + + +
+ Table of Contents +
    +
  1. Usage
  2. +
  3. Requirements
  4. +
  5. Providers
  6. +
  7. Modules
  8. +
  9. Resources
  10. +
  11. Inputs
  12. +
  13. Outputs
  14. +
  15. License
  16. +
  17. Contact
  18. +
  19. Acknowledgments
  20. +
+
+ + + +## Usage +### Simple Example +``` +module "hq" { + source = "github.com/zachreborn/terraform-modules//modules/vsphere/datacenter" + + folder = module.root_folder.id + name = "hq" +} +``` + +_For more examples, please refer to the [Documentation](https://github.com/zachreborn/terraform-modules)_ + +

(back to top)

+ + + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [aws](#requirement\_aws) | >= 2.5.0 | + +## Providers + +| Name | Version | +|------|---------| +| [vsphere](#provider\_vsphere) | n/a | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [vsphere_datacenter.this](https://registry.terraform.io/providers/hashicorp/vsphere/latest/docs/resources/datacenter) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [folder](#input\_folder) | The folder where the datacenter will be created. Forces a new resource if this is changed. | `string` | n/a | yes | +| [name](#input\_name) | The name of the datacenter. The name needs to be unique within the folder. Forces a new resource if this is changed. | `string` | n/a | yes | +| [tags](#input\_tags) | A map of tags to assign to the datacenter. | `map(string)` |
{
"terraform": "true"
}
| no | + +## Outputs + +| Name | Description | +|------|-------------| +| [id](#output\_id) | The ID of the datacenter. | +| [moid](#output\_moid) | The Managed Object ID of the datacenter. | + + + +## License + +Distributed under the MIT License. See `LICENSE.txt` for more information. + +

(back to top)

+ + + + +## Contact + +Zachary Hill - [![LinkedIn][linkedin-shield]][linkedin-url] - zhill@zacharyhill.co + +Project Link: [https://github.com/zachreborn/terraform-modules](https://github.com/zachreborn/terraform-modules) + +

(back to top)

+ + + + +## Acknowledgments + +* [Zachary Hill](https://zacharyhill.co) +* [Jake Jones](https://github.com/jakeasarus) + +

(back to top)

+ + + + +[contributors-shield]: https://img.shields.io/github/contributors/zachreborn/terraform-modules.svg?style=for-the-badge +[contributors-url]: https://github.com/zachreborn/terraform-modules/graphs/contributors +[forks-shield]: https://img.shields.io/github/forks/zachreborn/terraform-modules.svg?style=for-the-badge +[forks-url]: https://github.com/zachreborn/terraform-modules/network/members +[stars-shield]: https://img.shields.io/github/stars/zachreborn/terraform-modules.svg?style=for-the-badge +[stars-url]: https://github.com/zachreborn/terraform-modules/stargazers +[issues-shield]: https://img.shields.io/github/issues/zachreborn/terraform-modules.svg?style=for-the-badge +[issues-url]: https://github.com/zachreborn/terraform-modules/issues +[license-shield]: https://img.shields.io/github/license/zachreborn/terraform-modules.svg?style=for-the-badge +[license-url]: https://github.com/zachreborn/terraform-modules/blob/master/LICENSE.txt +[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555 +[linkedin-url]: https://www.linkedin.com/in/zachary-hill-5524257a/ +[product-screenshot]: /images/screenshot.webp +[Terraform.io]: https://img.shields.io/badge/Terraform-7B42BC?style=for-the-badge&logo=terraform +[Terraform-url]: https://terraform.io \ No newline at end of file diff --git a/modules/vsphere/datacenter/main.tf b/modules/vsphere/datacenter/main.tf new file mode 100755 index 00000000..8a9f29e7 --- /dev/null +++ b/modules/vsphere/datacenter/main.tf @@ -0,0 +1,15 @@ +terraform { + required_version = ">= 1.0.0" + required_providers { + aws = { + source = "hashicorp/vsphere" + version = ">= 2.5.0" + } + } +} + +resource "vsphere_datacenter" "this" { + folder = var.folder + name = var.name + tags = var.tags +} diff --git a/modules/vsphere/datacenter/outputs.tf b/modules/vsphere/datacenter/outputs.tf new file mode 100755 index 00000000..b701f4bc --- /dev/null +++ b/modules/vsphere/datacenter/outputs.tf @@ -0,0 +1,9 @@ +output "id" { + description = "The ID of the datacenter." + value = vsphere_datacenter.this.id +} + +output "moid" { + description = "The Managed Object ID of the datacenter." + value = vsphere_datacenter.this.moid +} diff --git a/modules/vsphere/datacenter/variables.tf b/modules/vsphere/datacenter/variables.tf new file mode 100755 index 00000000..0874b424 --- /dev/null +++ b/modules/vsphere/datacenter/variables.tf @@ -0,0 +1,17 @@ +variable "folder" { + type = string + description = "The folder where the datacenter will be created. Forces a new resource if this is changed." +} + +variable "name" { + type = string + description = "The name of the datacenter. The name needs to be unique within the folder. Forces a new resource if this is changed." +} + +variable "tags" { + type = map(string) + description = "A map of tags to assign to the datacenter." + default = { + terraform = "true" + } +} diff --git a/modules/vsphere/folder/README.md b/modules/vsphere/folder/README.md new file mode 100755 index 00000000..343fe12f --- /dev/null +++ b/modules/vsphere/folder/README.md @@ -0,0 +1,166 @@ + + + + + + + +[![Contributors][contributors-shield]][contributors-url] +[![Forks][forks-shield]][forks-url] +[![Stargazers][stars-shield]][stars-url] +[![Issues][issues-shield]][issues-url] +[![MIT License][license-shield]][license-url] +[![LinkedIn][linkedin-shield]][linkedin-url] + + + +
+
+ + Logo + + +

Folder

+

+ This module creates a vSphere Folder resource. +
+ Explore the docs » +
+
+ Zachary Hill + · + Report Bug + · + Request Feature +

+
+ + + +
+ Table of Contents +
    +
  1. Usage
  2. +
  3. Requirements
  4. +
  5. Providers
  6. +
  7. Modules
  8. +
  9. Resources
  10. +
  11. Inputs
  12. +
  13. Outputs
  14. +
  15. License
  16. +
  17. Contact
  18. +
  19. Acknowledgments
  20. +
+
+ + + +## Usage +### Simple Example +``` +module "hq" { + source = "github.com/zachreborn/terraform-modules//modules/vsphere/folder" + + datacenter_id = module.datacenter.id + path = "/" + type = "host" +} +``` + +_For more examples, please refer to the [Documentation](https://github.com/zachreborn/terraform-modules)_ + +

(back to top)

+ + + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [aws](#requirement\_aws) | >= 2.5.0 | + +## Providers + +| Name | Version | +|------|---------| +| [vsphere](#provider\_vsphere) | n/a | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [vsphere_folder.this](https://registry.terraform.io/providers/hashicorp/vsphere/latest/docs/resources/folder) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [custom\_attributes](#input\_custom\_attributes) | A list of custom attributes to apply to the folder. Unsupported on ESXi hosts, requires vCenter. | `map(string)` | `{}` | no | +| [datacenter\_id](#input\_datacenter\_id) | The ID of the datacenter where the folder should be created. Forces a new resource if changed. | `any` | n/a | yes | +| [path](#input\_path) | The path of the folder. Must be unique within the datacenter. This is relative to the root of the folder for the resource type being created. | `any` | n/a | yes | +| [tags](#input\_tags) | A map of tags to assign to the folder. | `map(string)` |
{
"terraform": "true"
}
| no | +| [type](#input\_type) | The type of the folder. Allowed options are: datacenter, host, vm, datastore, and network. If unset, the default is host. | `string` | `"host"` | no | + +## Outputs + +No outputs. + + + +## License + +Distributed under the MIT License. See `LICENSE.txt` for more information. + +

(back to top)

+ + + + +## Contact + +Zachary Hill - [![LinkedIn][linkedin-shield]][linkedin-url] - zhill@zacharyhill.co + +Project Link: [https://github.com/zachreborn/terraform-modules](https://github.com/zachreborn/terraform-modules) + +

(back to top)

+ + + + +## Acknowledgments + +* [Zachary Hill](https://zacharyhill.co) +* [Jake Jones](https://github.com/jakeasarus) + +

(back to top)

+ + + + +[contributors-shield]: https://img.shields.io/github/contributors/zachreborn/terraform-modules.svg?style=for-the-badge +[contributors-url]: https://github.com/zachreborn/terraform-modules/graphs/contributors +[forks-shield]: https://img.shields.io/github/forks/zachreborn/terraform-modules.svg?style=for-the-badge +[forks-url]: https://github.com/zachreborn/terraform-modules/network/members +[stars-shield]: https://img.shields.io/github/stars/zachreborn/terraform-modules.svg?style=for-the-badge +[stars-url]: https://github.com/zachreborn/terraform-modules/stargazers +[issues-shield]: https://img.shields.io/github/issues/zachreborn/terraform-modules.svg?style=for-the-badge +[issues-url]: https://github.com/zachreborn/terraform-modules/issues +[license-shield]: https://img.shields.io/github/license/zachreborn/terraform-modules.svg?style=for-the-badge +[license-url]: https://github.com/zachreborn/terraform-modules/blob/master/LICENSE.txt +[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555 +[linkedin-url]: https://www.linkedin.com/in/zachary-hill-5524257a/ +[product-screenshot]: /images/screenshot.webp +[Terraform.io]: https://img.shields.io/badge/Terraform-7B42BC?style=for-the-badge&logo=terraform +[Terraform-url]: https://terraform.io \ No newline at end of file diff --git a/modules/vsphere/folder/main.tf b/modules/vsphere/folder/main.tf new file mode 100755 index 00000000..cbfffaf2 --- /dev/null +++ b/modules/vsphere/folder/main.tf @@ -0,0 +1,18 @@ +terraform { + required_version = ">= 1.0.0" + required_providers { + aws = { + source = "hashicorp/vsphere" + version = ">= 2.5.0" + } + } +} + + +resource "vsphere_folder" "this" { + custom_attributes = var.custom_attributes + datacenter_id = var.datacenter_id + path = var.path + tags = var.tags + type = var.type +} diff --git a/modules/vsphere/folder/outputs.tf b/modules/vsphere/folder/outputs.tf new file mode 100755 index 00000000..e69de29b diff --git a/modules/vsphere/folder/variables.tf b/modules/vsphere/folder/variables.tf new file mode 100755 index 00000000..4380b7ce --- /dev/null +++ b/modules/vsphere/folder/variables.tf @@ -0,0 +1,27 @@ +variable "custom_attributes" { + description = "A list of custom attributes to apply to the folder. Unsupported on ESXi hosts, requires vCenter." + type = map(string) + default = {} +} + +variable "datacenter_id" { + description = "The ID of the datacenter where the folder should be created. Forces a new resource if changed." +} + +variable "path" { + description = "The path of the folder. Must be unique within the datacenter. This is relative to the root of the folder for the resource type being created." +} + +variable "tags" { + description = "A map of tags to assign to the folder." + type = map(string) + default = { + "terraform" = "true" + } +} + +variable "type" { + description = "The type of the folder. Allowed options are: datacenter, host, vm, datastore, and network. If unset, the default is host." + type = string + default = "host" +}