Skip to content

Commit

Permalink
feat: Allow to set region and project ID: (#4)
Browse files Browse the repository at this point in the history
* Define new variables.
* Assign these variables on all resources that support them
* Update documentation.
  • Loading branch information
benoit-garcia committed Feb 4, 2023
1 parent cc44cc8 commit 1e41a10
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ module "my_domain" {
|------|-------------|------|---------|:--------:|
| <a name="input_domain"></a> [domain](#input_domain) | n/a | `string` | n/a | yes |
| <a name="input_mx_servers"></a> [mx_servers](#input_mx_servers) | n/a | ```list(object({ address = string priority = number }))``` | ```[ { "address": ".", "priority": 0 } ]``` | no |
| <a name="input_project_id"></a> [project_id](#input_project_id) | ID of the project the domain is associated with. Ressource will be created in the region set by the provider if null. | `string` | `"null"` | no |
| <a name="input_region"></a> [region](#input_region) | Region in which the domain should be created. Ressource will be created in the region set by the provider if null. | `string` | `"null"` | no |
| <a name="input_setup_tem"></a> [setup_tem](#input_setup_tem) | n/a | `bool` | `false` | no |
| <a name="input_subdomain"></a> [subdomain](#input_subdomain) | n/a | `string` | `""` | no |

Expand Down
9 changes: 6 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
resource "scaleway_domain_zone" "this" {
domain = var.domain
subdomain = var.subdomain
domain = var.domain
project_id = var.project_id
subdomain = var.subdomain
}

resource "scaleway_tem_domain" "this" {
count = var.setup_tem ? 1 : 0

name = local.dns_zone
name = local.dns_zone
project_id = var.project_id
region = var.region
}

resource "scaleway_domain_record" "dkim" {
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ variable "mx_servers" {
}]
}

variable "project_id" {
description = "ID of the project the domain is associated with. Ressource will be created in the region set by the provider if null."
type = string
default = null
}

variable "region" {
description = "Region in which the domain should be created. Ressource will be created in the region set by the provider if null."
type = string
default = null
}

variable "subdomain" {
type = string
default = ""
Expand Down

0 comments on commit 1e41a10

Please sign in to comment.