|
| 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 | + |
0 commit comments