Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
Add customizable create and delete timeouts for DNS zone and DNS zone…
Browse files Browse the repository at this point in the history
… record resources
  • Loading branch information
F21 authored and alexk53 committed Jan 16, 2023
1 parent 975a2f7 commit 1b36289
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/resources/gcore_dns_zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,22 @@ resource "gcore_dns_zone" "example_zone" {

- `name` (String) A name of DNS Zone resource.

### Optional

- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- `create` (String)
- `delete` (String)

## Import

Import is supported using the following syntax:
Expand Down
10 changes: 10 additions & 0 deletions docs/resources/gcore_dns_zone_record.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ resource "gcore_dns_zone_record" "subdomain_examplezone_caa" {
### Optional

- `filter` (Block Set) (see [below for nested schema](#nestedblock--filter))
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `ttl` (Number) A ttl of DNS Zone Record resource.

### Read-Only
Expand Down Expand Up @@ -158,6 +159,15 @@ Optional:
- `limit` (Number) A DNS Zone Record filter option that describe how many records will be percolated.
- `strict` (Boolean) A DNS Zone Record filter option that describe possibility to return answers if no records were percolated through filter.


<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- `create` (String)
- `delete` (String)

## Import

Import is supported using the following syntax:
Expand Down
5 changes: 5 additions & 0 deletions gcore/resource_gcore_dns_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"strings"
"time"

"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down Expand Up @@ -33,6 +34,10 @@ func resourceDNSZone() *schema.Resource {
Description: "A name of DNS Zone resource.",
},
},
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(5 * time.Minute),
Delete: schema.DefaultTimeout(5 * time.Minute),
},
CreateContext: checkDNSDependency(resourceDNSZoneCreate),
ReadContext: checkDNSDependency(resourceDNSZoneRead),
DeleteContext: checkDNSDependency(resourceDNSZoneDelete),
Expand Down
5 changes: 5 additions & 0 deletions gcore/resource_gcore_dns_zone_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"net"
"strings"
"time"

dnssdk "github.com/G-Core/gcore-dns-sdk-go"
"github.com/hashicorp/go-cty/cty"
Expand Down Expand Up @@ -232,6 +233,10 @@ func resourceDNSZoneRecord() *schema.Resource {
Description: "An array of contents with meta of DNS Zone Record resource.",
},
},
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(5 * time.Minute),
Delete: schema.DefaultTimeout(5 * time.Minute),
},
CreateContext: checkDNSDependency(resourceDNSZoneRecordCreate),
UpdateContext: checkDNSDependency(resourceDNSZoneRecordUpdate),
ReadContext: checkDNSDependency(resourceDNSZoneRecordRead),
Expand Down

0 comments on commit 1b36289

Please sign in to comment.