-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add resource ovh_domain_name #837
Conversation
ovh/resource_domain_name.go
Outdated
|
||
serviceName := data.DomainName.ValueString() | ||
|
||
serviceID, err := serviceIdFromResourceName(r.config.OVHClient, serviceName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/services service name are not unique, meaning that domain name will have the same service name than the web hosting attached to the domain name, or the dns zone
As here
terraform-provider-ovh/ovh/services.go
Line 57 in 257f28b
return serviceIds[0], nil |
We need to make serviceIdFromResourceName
evolve to handle "serviceType"
|
||
```hcl | ||
resource "ovh_domain_name" "domain" { | ||
domain_name = "a-great-domain.ovh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domain_name = "a-great-domain.ovh" | |
domain_name = "example.com" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had previous case in Golang code base where they use funny domain name for their tests, and the domain was not registered. Then this domain started to display undesirable content.
Let's stick to example.com here, which is a protected domain for documentation and RFC
257f28b
to
182f006
Compare
ovh/services.go
Outdated
@@ -57,6 +57,17 @@ func serviceIdFromResourceName(c *ovh.Client, resourceName string) (int, error) | |||
return serviceIds[0], nil | |||
} | |||
|
|||
func serviceIdFromRouteAndResourceName(c *ovh.Client, route, resourceName string) (int, error) { | |||
var serviceIds []int | |||
endpoint := fmt.Sprintf("/services?resourceName=%s&routes=%s", url.PathEscape(resourceName), url.PathEscape(route)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint := fmt.Sprintf("/services?resourceName=%s&routes=%s", url.PathEscape(resourceName), url.PathEscape(route)) | |
endpoint := fmt.Sprintf("/services?resourceName=%s&routes=%s", url.QueryEscape(resourceName), url.QueryEscape(route)) |
182f006
to
faff727
Compare
Description
Add resource
ovh_domain_name
.Type of change
How Has This Been Tested?
make testacc TESTARGS="-run TestAccResourceDomainName_basic"
Checklist:
go mod vendor
if I added or modifygo.mod
file