Skip to content

Commit

Permalink
Added support for NS DNS record
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr committed Nov 5, 2024
1 parent 18ba0a3 commit ce11044
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions civo/dns/resource_dns_domain_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func ResourceDNSDomainRecord() *schema.Resource {
civogo.DNSRecordTypeMX,
civogo.DNSRecordTypeTXT,
civogo.DNSRecordTypeSRV,
civogo.DNSRecordTypeNS,
}, false),
},
"name": {
Expand Down Expand Up @@ -123,6 +124,10 @@ func resourceDNSDomainRecordCreate(ctx context.Context, d *schema.ResourceData,
config.Type = civogo.DNSRecordTypeTXT
}

if d.Get("type").(string) == "NS" {
config.Type = civogo.DNSRecordTypeNS
}

log.Printf("[INFO] Creating the domain record %s", d.Get("name").(string))
dnsDomainRecord, err := apiClient.CreateDNSRecord(d.Get("domain_id").(string), config)
if err != nil {
Expand Down Expand Up @@ -199,6 +204,10 @@ func resourceDNSDomainRecordUpdate(ctx context.Context, d *schema.ResourceData,
if d.Get("type").(string) == "TXT" {
config.Type = civogo.DNSRecordTypeTXT
}

if d.Get("type").(string) == "NS" {
config.Type = civogo.DNSRecordTypeNS
}
}

log.Printf("[INFO] Updating the domain record %s", d.Get("name").(string))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/civo/terraform-provider-civo

require (
github.com/civo/civogo v0.3.84
github.com/civo/civogo v0.3.85
github.com/google/uuid v1.3.1
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/civo/civogo v0.3.84 h1:jf5IT7VJFPaReO6g8B0zqKhsYCIizaGo4PjDLY7Sl6Y=
github.com/civo/civogo v0.3.84/go.mod h1:7UCYX+qeeJbrG55E1huv+0ySxcHTqq/26FcHLVelQJM=
github.com/civo/civogo v0.3.85 h1:rXRbDT9B60Ocp/IxAoAs90yAJog2la1MajQqgXETxd4=
github.com/civo/civogo v0.3.85/go.mod h1:7UCYX+qeeJbrG55E1huv+0ySxcHTqq/26FcHLVelQJM=
github.com/cloudflare/circl v1.3.3 h1:fE/Qz0QdIGqeWfnwq0RE0R7MI51s0M2E4Ga9kq5AEMs=
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
Expand Down

0 comments on commit ce11044

Please sign in to comment.