-
Notifications
You must be signed in to change notification settings - Fork 139
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 ds records and name servers resources for domains #818
Conversation
ovh/resource_domain_ds_records.go
Outdated
|
||
log.Printf("[DEBUG] Will read domain name DS records: %s\n", domainName) | ||
|
||
responseData := &[]int{} |
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.
responseData := &[]int{} | |
var responseData []int |
ovh/types_domain.go
Outdated
@@ -0,0 +1,16 @@ | |||
package ovh | |||
|
|||
type DomainTask struct { |
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.
since this is the exact same struct as DomainZoneTask
in file types_domain_zone.go
, could you keep only one ? (keeping this one is fine by me since these tasks are common to all /domain section)
ovh/domain_task.go
Outdated
"time" | ||
) | ||
|
||
func waitDomainTask(client *ovh.Client, domainName string, taskId int) error { |
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 should move this in types_domain.go
to keep consistency with the existing code
ovh/resource_domain_ds_records.go
Outdated
responseData := &DomainDsRecord{} | ||
endpoint := fmt.Sprintf("/domain/%s/dsRecord/%d", url.PathEscape(domainName), dsRecordId) | ||
|
||
if err := config.OVHClient.Get(endpoint, &responseData); err != nil { | ||
return helpers.CheckDeleted(resourceData, err, endpoint) | ||
} | ||
|
||
domainDsRecords.DsRecords = append(domainDsRecords.DsRecords, *responseData) |
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.
responseData := &DomainDsRecord{} | |
endpoint := fmt.Sprintf("/domain/%s/dsRecord/%d", url.PathEscape(domainName), dsRecordId) | |
if err := config.OVHClient.Get(endpoint, &responseData); err != nil { | |
return helpers.CheckDeleted(resourceData, err, endpoint) | |
} | |
domainDsRecords.DsRecords = append(domainDsRecords.DsRecords, *responseData) | |
responseData := DomainDsRecord{} | |
endpoint := fmt.Sprintf("/domain/%s/dsRecord/%d", url.PathEscape(domainName), dsRecordId) | |
if err := config.OVHClient.Get(endpoint, &responseData); err != nil { | |
return helpers.CheckDeleted(resourceData, err, endpoint) | |
} | |
domainDsRecords.DsRecords = append(domainDsRecords.DsRecords, responseData) |
ovh/resource_domain_ds_records.go
Outdated
func resourceDomainDsRecordsUpdate(resourceData *schema.ResourceData, meta interface{}) error { | ||
config := meta.(*Config) | ||
domainName := resourceData.Get("domain").(string) | ||
task := &DomainTask{} |
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.
task := &DomainTask{} | |
task := DomainTask{} |
ovh/resource_domain_name_servers.go
Outdated
} | ||
|
||
for _, nameServerId := range *responseData { | ||
responseData := &DomainNameServer{} |
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.
responseData := &DomainNameServer{} | |
responseData := DomainNameServer{} |
ovh/resource_domain_name_servers.go
Outdated
domainNameServers.Servers = append(domainNameServers.Servers, *responseData) | ||
} | ||
|
||
sort.Slice(domainNameServers.Servers, func(i, j int) bool { |
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.
not sure why we want to sort this array ? I think the field servers
could be a TypeSet
so we could avoid this sort
ovh/resource_domain_name_servers.go
Outdated
func resourceDomainNameServersUpdate(resourceData *schema.ResourceData, meta interface{}) error { | ||
config := meta.(*Config) | ||
domainName := resourceData.Get("domain").(string) | ||
task := &DomainTask{} |
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.
task := &DomainTask{} | |
task := DomainTask{} |
|
||
provider := testAccProvider.Meta().(*Config) | ||
|
||
responseData := &[]int{} |
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.
responseData := &[]int{} | |
var responseData []int |
var domainNameServerList []DomainNameServer | ||
|
||
for _, nameServerId := range *responseData { | ||
responseData := &DomainNameServer{} |
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.
responseData := &DomainNameServer{} | |
responseData := DomainNameServer{} |
@App13Pie any news on this PR ? We will soon release a new major version of the provider and your new resources would be a great addition to this this release ! |
Hi @amstuta, sorry I've got a lot of work right now and won't be able to finish this PR.. |
No problem, I'll finish the work then ! |
Description
Added two resources for OVH domains:
TODO: I haven't updated the documentation.
Fixes #146 (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I created a public zone on GPC Cloud DNS to have valid values to pass down to the below tests.
You'll have to export these environment variables:
make testacc TESTARGS="-run TestAccDomainNameServers_Basic"
Test Configuration:
terraform version
: Terraform v1.10.5make testacc TESTARGS="-run TestAccDomainDsRecords_Basic"
Test Configuration:
terraform version
: Terraform v1.10.5Checklist:
go mod vendor
if I added or modifygo.mod
file