-
Notifications
You must be signed in to change notification settings - Fork 135
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
base: master
Are you sure you want to change the base?
Conversation
|
||
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 |
@@ -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)
"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
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) |
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{} |
} | ||
|
||
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{} |
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
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{} |
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