Skip to content

Commit aff03e4

Browse files
jremy42remyleonedevtools-ci-cdLaure-diyfodil
authored
feat(domain): add support for buying and registar domains (#2799)
* feat(domain): add support for buying and registar domains * feat(domain): add helpers for expand contact * feat(domain): add test for create and read * feat(domain): add chore of new resource order domain * feat(domain): add chore of new resource order domain * feat: resource can order a list of domains * chore: add test * add print for debug * remove comments * change datastructure * add data source for domain * add doc * add data_source for domains_registration * test: add cassettes * test: add multiple test * bump sdk go * bump sdk go * fix lint * fix lint * fix error * fix skipped test fix doc fix tf lint fix lint fix lint fix lint fix lint fix lint cleanup: remove commented helpers * fix(domain): remove ds records option * purge(cockpit): remove plan from cockpit (#2968) * fix(cockpit): purge plan * fix(cockpit): fix lint * feat(mongodb): vpc support (#2967) * feat(mongodb): vpc support * feat(mongodb): add doc * feat(container): add support for local_storage_limit (#2969) Co-authored-by: devtools-ci-cd <[email protected]> * fix(container): add support for putting region in the state after import (#2970) Co-authored-by: devtools-ci-cd <[email protected]> * fix(apple-silicon): add username and password (#2971) * feat(edge_services): add resources (#2637) * bump sdk go * add resources * add docs * lint * goimports * fix tests * fix * update test * rename functions * refacto * fix * bump sdk go * update resources to v1beta1 * update doc * gofumpt * lint * lint * fix tfproviderdocs lint * fix lb origin * check non-nil HeadStage * update descriptions --------- Co-authored-by: Rémy Léone <[email protected]> --------- Co-authored-by: Rémy Léone <[email protected]> Co-authored-by: devtools-ci-cd <[email protected]> Co-authored-by: Laure-di <[email protected]> Co-authored-by: Yacine Fodil <[email protected]>
1 parent 54915ec commit aff03e4

11 files changed

+18014
-3
lines changed

docs/resources/domain_registration.md

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
subcategory: "Domains and DNS"
3+
page_title: "Scaleway: scaleway_domain_registration"
4+
---
5+
6+
# Resource: scaleway_domain_registration
7+
8+
The `scaleway_domain_registration` resource allows you to purchase and manage domain registrations with Scaleway. Using this resource you can register one or more domains for a specified duration, configure auto-renewal and DNSSEC options, and set contact information. You can supply an owner contact either by providing an existing contact ID or by specifying the complete contact details. The resource automatically returns additional contact information (administrative and technical) as provided by the Scaleway API.
9+
10+
Refer to the [Domains and DNS documentation](https://www.scaleway.com/en/docs/network/domains-and-dns/) and the [API documentation](https://developers.scaleway.com/) for more details.
11+
12+
## Example Usage
13+
14+
### Purchase a Single Domain
15+
16+
The following example purchases a domain with a one-year registration period and specifies the owner contact details. Administrative and technical contacts are returned by the API.
17+
18+
```terraform
19+
resource "scaleway_domain_registration" "test" {
20+
domain_names = ["example.com"]
21+
duration_in_years = 1
22+
23+
owner_contact {
24+
legal_form = "individual"
25+
firstname = "John"
26+
lastname = "DOE"
27+
28+
phone_number = "+1.23456789"
29+
address_line_1 = "123 Main Street"
30+
city = "Paris"
31+
zip = "75001"
32+
country = "FR"
33+
vat_identification_code = "FR12345678901"
34+
company_identification_code = "123456789"
35+
}
36+
}
37+
```
38+
39+
### Update Domain Settings
40+
41+
You can update the resource to enable auto-renewal and DNSSEC:
42+
43+
```terraform
44+
resource "scaleway_domain_registration" "test" {
45+
domain_names = ["example.com"]
46+
duration_in_years = 1
47+
48+
owner_contact {
49+
legal_form = "individual"
50+
firstname = "John"
51+
lastname = "DOE"
52+
53+
phone_number = "+1.23456789"
54+
address_line_1 = "123 Main Street"
55+
city = "Paris"
56+
zip = "75001"
57+
country = "FR"
58+
vat_identification_code = "FR12345678901"
59+
company_identification_code = "123456789"
60+
}
61+
62+
auto_renew = true
63+
dnssec = true
64+
}
65+
```
66+
67+
### Purchase Multiple Domains
68+
69+
The following example registers several domains in one go:
70+
71+
```terraform
72+
resource "scaleway_domain_registration" "multi" {
73+
domain_names = ["domain1.com", "domain2.com", "domain3.com"]
74+
duration_in_years = 1
75+
76+
owner_contact {
77+
legal_form = "individual"
78+
firstname = "John"
79+
lastname = "DOE"
80+
81+
phone_number = "+1.23456789"
82+
address_line_1 = "123 Main Street"
83+
city = "Paris"
84+
zip = "75001"
85+
country = "FR"
86+
vat_identification_code = "FR12345678901"
87+
company_identification_code = "123456789"
88+
}
89+
}
90+
```
91+
92+
## Argument Reference
93+
94+
The following arguments are supported:
95+
96+
- `domain_names` (Required, List of String): A list of domain names to be registered.
97+
- `duration_in_years` (Optional, Integer, Default: 1): The registration period in years.
98+
- `project_id` (Optional, String): The Scaleway project ID.
99+
- `owner_contact_id` (Optional, String): The ID of an existing owner contact.
100+
- `owner_contact` (Optional, List): Details of the owner contact.
101+
- `administrative_contact` (Computed, List): Administrative contact information.
102+
- `technical_contact` (Computed, List): Technical contact information.
103+
- `auto_renew` (Optional, Boolean, Default: false): Enables or disables auto-renewal.
104+
- `dnssec` (Optional, Boolean, Default: false): Enables or disables DNSSEC.
105+
106+
## Attributes Reference
107+
108+
In addition to all arguments above, the following attributes are exported:
109+
110+
- `id`: The ID of the domain registration.
111+
- `updated_at`: Timestamp of the last update.
112+
- `expired_at`: Expiration date/time of the domain registration.
113+
- `epp_code`: EPP code(s) associated with the domain.
114+
- `registrar`: Name of the registrar.
115+
- `status`: Status of the domain registration.
116+
- `dns_zones`: List of DNS zones associated with the domain.
117+
- `ds_record`: DNSSEC DS record configuration.
118+
- `task_id`: ID of the task that created the domain.
119+
120+
121+
122+
## Contact Blocks
123+
124+
Each contact block supports the following attributes:
125+
126+
- `legal_form` (Required, String): Legal form of the contact.
127+
- `firstname` (Required, String): First name.
128+
- `lastname` (Required, String): Last name.
129+
- `company_name` (Optional, String): Company name.
130+
- `email` (Required, String): Primary email.
131+
- `phone_number` (Required, String): Primary phone number.
132+
- `address_line_1` (Required, String): Primary address.
133+
- `zip` (Required, String): Postal code.
134+
- `city` (Required, String): City.
135+
- `country` (Required, String): Country code (ISO format).
136+
- `vat_identification_code` (Required, String): VAT identification code.
137+
- `company_identification_code` (Required, String): Company identification code.
138+
139+
## Import
140+
141+
To import an existing domain registration, use:
142+
143+
```bash
144+
terraform import scaleway_domain_registration.test <project_id>/<task_id>
145+
```
146+
147+
148+

internal/provider/provider.go

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func Provider(config *Config) plugin.ProviderFunc {
140140
"scaleway_container_token": container.ResourceToken(),
141141
"scaleway_container_trigger": container.ResourceTrigger(),
142142
"scaleway_domain_record": domain.ResourceRecord(),
143+
"scaleway_domain_registration": domain.ResourceRegistration(),
143144
"scaleway_domain_zone": domain.ResourceZone(),
144145
"scaleway_edge_services_backend_stage": edgeservices.ResourceBackendStage(),
145146
"scaleway_edge_services_cache_stage": edgeservices.ResourceCacheStage(),

0 commit comments

Comments
 (0)