-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: zone dns sec testdata and custom code
- Loading branch information
Vaishak Dinesh
committed
Nov 19, 2024
1 parent
9073ff3
commit 16f8f8d
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package zone_dnssec | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cloudflare/cloudflare-go/v3" | ||
"github.com/cloudflare/cloudflare-go/v3/dnssec" | ||
"github.com/cloudflare/cloudflare-go/v3/option" | ||
"github.com/cloudflare/terraform-provider-cloudflare/internal/logging" | ||
"github.com/hashicorp/terraform-plugin-framework/resource" | ||
) | ||
|
||
func disableDNSSECRecord(ctx context.Context, r *ZoneDNSSECResource, zoneID string, resp *resource.DeleteResponse) { | ||
var err error | ||
_, err = r.client.DNSSEC.Edit( | ||
ctx, | ||
dnssec.DNSSECEditParams{ | ||
ZoneID: cloudflare.F(zoneID), | ||
Status: cloudflare.F[dnssec.DNSSECEditParamsStatus](dnssec.DNSSECEditParamsStatusDisabled), | ||
}, | ||
option.WithMiddleware(logging.Middleware(ctx)), | ||
) | ||
if err != nil { | ||
resp.Diagnostics.AddError("failed to make http request", err.Error()) | ||
return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
internal/services/zone_dnssec/testdata/zonednsdatasourceconfig.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
resource "cloudflare_zone_dnssec" "%[1]s" { | ||
zone_id = "%[2]s" | ||
status = "active" | ||
} | ||
|
||
data "cloudflare_zone_dnssec" "%[1]s" { | ||
zone_id = "%[2]s" | ||
depends_on = [ "cloudflare_dns_zone_dnssec.%[1]s" ] | ||
} |
2 changes: 1 addition & 1 deletion
2
internal/services/zone_dnssec/testdata/zonednssecresourceconfig.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
resource "cloudflare_zone_dnssec" "%s" { | ||
zone_id = "%s" | ||
status = "active" | ||
} |