diff --git a/ovh/gateway/README.md b/ovh/gateway/README.md new file mode 100644 index 0000000..955ff92 --- /dev/null +++ b/ovh/gateway/README.md @@ -0,0 +1,50 @@ +# OVH gateway + +Create an OVH gateway + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | ~> 1.3 | +| [ovh](#requirement\_ovh) | ~> 2.1 | +| [time](#requirement\_time) | ~> 0.9.1 | + +## Providers + +| Name | Version | +|------|---------| +| [ovh](#provider\_ovh) | ~> 2.1 | +| [time](#provider\_time) | ~> 0.9.1 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [ovh_cloud_project_gateway.gateway](https://registry.terraform.io/providers/ovh/ovh/latest/docs/resources/cloud_project_gateway) | resource | +| [time_static.last_update](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/static) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cloud\_project\_id](#input\_cloud\_project\_id) | The OVH public cloud project id | `string` | n/a | yes | +| [customer](#input\_customer) | Customer for the current deployment | `string` | `""` | no | +| [model](#input\_model) | Model of the gateway | `string` | n/a | yes | +| [name](#input\_name) | Name applied to this instance | `string` | `""` | no | +| [network\_id](#input\_network\_id) | ID of the private network | `string` | n/a | yes | +| [region](#input\_region) | Region of the gateway | `string` | n/a | yes | +| [subnet\_id](#input\_subnet\_id) | ID of the subnet | `string` | n/a | yes | +| [tags](#input\_tags) | Default tags to add to resources | `map(any)` | `{}` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [id](#output\_id) | n/a | + diff --git a/ovh/gateway/gateway.tf b/ovh/gateway/gateway.tf new file mode 100644 index 0000000..dfd20a2 --- /dev/null +++ b/ovh/gateway/gateway.tf @@ -0,0 +1,8 @@ +resource "ovh_cloud_project_gateway" "gateway" { + service_name = var.cloud_project_id + name = var.name + model = var.model + region = var.region + network_id = var.network_id + subnet_id = var.subnet_id +} diff --git a/ovh/gateway/main.tf b/ovh/gateway/main.tf new file mode 100644 index 0000000..b5f8ba8 --- /dev/null +++ b/ovh/gateway/main.tf @@ -0,0 +1,14 @@ +locals { + # tflint-ignore: terraform_unused_declarations + interpolated_tags = merge({ + "Name" = var.name, + "Customer" = var.customer, + "ManagedBy" = "Terraform", + "LastModifiedAt" = time_static.last_update.rfc3339, + }, + var.tags + ) +} + +resource "time_static" "last_update" { +} diff --git a/ovh/gateway/outputs.tf b/ovh/gateway/outputs.tf new file mode 100644 index 0000000..58e2c4e --- /dev/null +++ b/ovh/gateway/outputs.tf @@ -0,0 +1,3 @@ +output "id" { + value = ovh_cloud_project_gateway.gateway.id +} diff --git a/ovh/gateway/providers.tf b/ovh/gateway/providers.tf new file mode 100644 index 0000000..095ffbd --- /dev/null +++ b/ovh/gateway/providers.tf @@ -0,0 +1,13 @@ +terraform { + required_version = "~> 1.3" + required_providers { + ovh = { + source = "ovh/ovh" + version = "~> 2.1" + } + time = { + source = "hashicorp/time", + version = "~> 0.9.1" + } + } +} diff --git a/ovh/gateway/variables.tf b/ovh/gateway/variables.tf new file mode 100644 index 0000000..84b5175 --- /dev/null +++ b/ovh/gateway/variables.tf @@ -0,0 +1,44 @@ +variable "name" { + description = "Name applied to this instance" + type = string + default = "" +} + +variable "customer" { + description = "Customer for the current deployment" + type = string + default = "" +} + +variable "tags" { + description = "Default tags to add to resources" + type = map(any) + default = {} +} + +# bellow are specific modules variables +variable "cloud_project_id" { + description = "The OVH public cloud project id" + type = string +} + +variable "model" { + type = string + description = "Model of the gateway" +} + +variable "region" { + type = string + description = "Region of the gateway" +} + +variable "network_id" { + type = string + description = "ID of the private network" +} + +variable "subnet_id" { + type = string + description = "ID of the subnet" +} +