-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
444 additions
and
38 deletions.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/swagger_flat.json | ||
/swagger_go.json | ||
/.env | ||
plan.out | ||
*.out | ||
|
||
*.dll | ||
*.exe | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,21 @@ | ||
package provider | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-testing/terraform" | ||
) | ||
|
||
func TestAccDataDnsZone(t *testing.T) { | ||
accTest(t, []resource.TestStep{ | ||
{ | ||
Config: `data "netlify_dns_zone" "example" { | ||
name = "examplepetstore.com" | ||
}`, | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("data.netlify_dns_zone.example", "id", "66afdbce3cf2b4f0fab520d9"), | ||
), | ||
}, | ||
}, func(s *terraform.State) error { return nil }) | ||
} |
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
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,58 @@ | ||
package provider | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
"github.com/hashicorp/terraform-plugin-testing/plancheck" | ||
"github.com/hashicorp/terraform-plugin-testing/terraform" | ||
) | ||
|
||
func TestAccDnsZone(t *testing.T) { | ||
accTest(t, []resource.TestStep{ | ||
{ | ||
Config: `resource "netlify_dns_zone" "example" { | ||
name = "tfsoftsecretnetlifytestingexamplestore.com" | ||
team_slug = "netlify-terraform-test" | ||
}`, | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("netlify_dns_zone.example", "id"), | ||
resource.TestCheckResourceAttr("netlify_dns_zone.example", "team_id", "66ae34e11a567e9092e3850f"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "netlify_dns_zone.example", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"last_updated"}, | ||
}, | ||
|
||
{ | ||
Config: `resource "netlify_dns_zone" "example" { | ||
name = "tfsoftsecretnetlifytestingexamplestore2.com" | ||
team_slug = "netlify-terraform-test" | ||
}`, | ||
ConfigPlanChecks: resource.ConfigPlanChecks{ | ||
PreApply: []plancheck.PlanCheck{ | ||
plancheck.ExpectResourceAction("netlify_dns_zone.example", plancheck.ResourceActionReplace), | ||
}, | ||
}, | ||
}, | ||
}, testAccDnsZoneDestroy) | ||
} | ||
|
||
func testAccDnsZoneDestroy(s *terraform.State) error { | ||
for _, m := range s.Modules { | ||
if v, ok := m.Resources["netlify_dns_zone.example"]; ok { | ||
key, _, err := testAccProvider.client.DNSZonesAPI.GetDnsZone(context.Background(), v.Primary.Attributes["id"]).Execute() | ||
if err != nil { | ||
//lint:ignore nilerr we expect an error to know it was not found | ||
return nil | ||
} | ||
return fmt.Errorf("DNS zone still exists: %s", key.Id) | ||
} | ||
} | ||
return fmt.Errorf("not found in testAccDnsZoneDestroy check destroy") | ||
} |
Oops, something went wrong.