Skip to content
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

Support 0.12 #309

Merged
merged 17 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ website/vendor

# Test exclusions
!command/test-fixtures/**/*.tfstate
!command/test-fixtures/**/.terraform/
!command/test-fixtures/**/.terraform

terraform-provider-cloudflare
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="600px">

Requirements
------------
## Requirements

- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
- [Terraform](https://www.terraform.io/downloads.html) 0.12.x
- [Go](https://golang.org/doc/install) 1.11 (to build the provider plugin)

## Building The Provider
Expand Down Expand Up @@ -61,7 +60,10 @@ comment it/remove it when it's not in use to avoid tripping yourself up.

## Developing the Provider

If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.9+ is *required*). You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well as adding `$GOPATH/bin` to your `$PATH`.
If you wish to work on the provider, you'll first need [Go](http://www.golang.org)
installed on your machine (version 1.11+ is *required*). You'll also need to
correctly setup a [GOPATH](http://golang.org/doc/code.html#GOPATH), as well
as adding `$GOPATH/bin` to your `$PATH`.

See above for which option suits your workflow for building the provider.

Expand Down
3 changes: 1 addition & 2 deletions cloudflare/import_cloudflare_load_balancer_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import (
"testing"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccCloudflareLoadBalancerPool_Import(t *testing.T) {
t.Parallel()
var loadBalancerPool cloudflare.LoadBalancerPool
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer_pool." + rnd

resource.Test(t, resource.TestCase{
Expand Down
3 changes: 1 addition & 2 deletions cloudflare/import_cloudflare_load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import (
"fmt"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccCloudflareLoadBalancer_Import(t *testing.T) {
t.Parallel()
var loadBalancer cloudflare.LoadBalancer
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer." + rnd

resource.Test(t, resource.TestCase{
Expand Down
3 changes: 1 addition & 2 deletions cloudflare/import_cloudflare_rate_limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import (
"fmt"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccCloudflareRateLimit_Import(t *testing.T) {
t.Parallel()
var rateLimit cloudflare.RateLimit
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_rate_limit." + rnd

resource.Test(t, resource.TestCase{
Expand Down
3 changes: 1 addition & 2 deletions cloudflare/import_cloudflare_spectrum_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"testing"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

Expand All @@ -15,7 +14,7 @@ func TestAccCloudflareSpectrumApplication_Import(t *testing.T) {
var application cloudflare.SpectrumApplication
zone := os.Getenv("CLOUDFLARE_DOMAIN")
zoneID := os.Getenv("CLOUDFLARE_ZONE_ID")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_spectrum_application." + rnd

resource.Test(t, resource.TestCase{
Expand Down
5 changes: 3 additions & 2 deletions cloudflare/import_cloudflare_waf_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ func TestAccCloudflareWAFRule_Import(t *testing.T) {
t.Parallel()
zone := os.Getenv("CLOUDFLARE_DOMAIN")
ruleID := "100000"
name := generateRandomResourceName()

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckCloudflareWAFRuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckCloudflareWAFRuleConfig(zone, ruleID, "block"),
Config: testAccCheckCloudflareWAFRuleConfig(zone, ruleID, "block", name),
},
{
ResourceName: "cloudflare_waf_rule." + ruleID,
ResourceName: "cloudflare_waf_rule." + name,
ImportStateIdPrefix: fmt.Sprintf("%s/", zone),
ImportState: true,
ImportStateVerify: true,
Expand Down
7 changes: 3 additions & 4 deletions cloudflare/import_cloudflare_worker_route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ import (
"testing"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccCloudflareWorkerRoute_Import(t *testing.T) {
var route cloudflare.WorkerRoute
zone := os.Getenv("CLOUDFLARE_DOMAIN")
routeRnd := acctest.RandString(10)
routeRnd := generateRandomResourceName()
routeName := "cloudflare_worker_route." + routeRnd
pattern := fmt.Sprintf("%s/%s", zone, acctest.RandString(10))
pattern := fmt.Sprintf("%s/%s", zone, generateRandomResourceName())

// We also create a script in order to test routes since routes
// need to point to a script
scriptRnd := acctest.RandString(10)
scriptRnd := generateRandomResourceName()

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand Down
3 changes: 1 addition & 2 deletions cloudflare/import_cloudflare_worker_script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import (
"testing"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccCloudflareWorkerScript_Import(t *testing.T) {
var script cloudflare.WorkerScript
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_worker_script." + rnd

resource.Test(t, resource.TestCase{
Expand Down
5 changes: 5 additions & 0 deletions cloudflare/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
)
Expand Down Expand Up @@ -68,3 +69,7 @@ func testAccPreCheckLogpushToken(t *testing.T) {
t.Fatal("CLOUDFLARE_ZONE_ID must be set for this acceptance test")
}
}

func generateRandomResourceName() string {
return acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)
}
2 changes: 1 addition & 1 deletion cloudflare/resource_cloudflare_access_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func testAccessRuleAccountConfig(mode, notes, target, value string) string {
resource "cloudflare_access_rule" "test" {
notes = "%[2]s"
mode = "%[1]s"
configuration {
configuration = {
target = "%[3]s"
value = "%[4]s"
}
Expand Down
3 changes: 1 addition & 2 deletions cloudflare/resource_cloudflare_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestFilterSimple(t *testing.T) {
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_filter." + rnd
zone := os.Getenv("CLOUDFLARE_DOMAIN")

Expand Down
3 changes: 1 addition & 2 deletions cloudflare/resource_cloudflare_firewall_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"os"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestFirewallRuleSimple(t *testing.T) {
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_firewall_rule." + rnd
zone := os.Getenv("CLOUDFLARE_DOMAIN")

Expand Down
7 changes: 3 additions & 4 deletions cloudflare/resource_cloudflare_load_balancer_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand All @@ -17,7 +16,7 @@ func TestAccCloudflareLoadBalancerPool_Basic(t *testing.T) {
t.Parallel()
testStartTime := time.Now().UTC()
var loadBalancerPool cloudflare.LoadBalancerPool
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer_pool." + rnd

resource.Test(t, resource.TestCase{
Expand All @@ -43,7 +42,7 @@ func TestAccCloudflareLoadBalancerPool_Basic(t *testing.T) {
func TestAccCloudflareLoadBalancerPool_FullySpecified(t *testing.T) {
t.Parallel()
var loadBalancerPool cloudflare.LoadBalancerPool
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer_pool." + rnd

resource.Test(t, resource.TestCase{
Expand All @@ -70,7 +69,7 @@ func TestAccCloudflareLoadBalancerPool_CreateAfterManualDestroy(t *testing.T) {
t.Parallel()
var loadBalancerPool cloudflare.LoadBalancerPool
var initialId string
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer_pool." + rnd

resource.Test(t, resource.TestCase{
Expand Down
13 changes: 6 additions & 7 deletions cloudflare/resource_cloudflare_load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"regexp"

"github.com/cloudflare/cloudflare-go"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
)
Expand All @@ -23,7 +22,7 @@ func TestAccCloudflareLoadBalancer_Basic(t *testing.T) {
testStartTime := time.Now().UTC()
var loadBalancer cloudflare.LoadBalancer
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer." + rnd

resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -55,7 +54,7 @@ func TestAccCloudflareLoadBalancer_SessionAffinity(t *testing.T) {
t.Parallel()
var loadBalancer cloudflare.LoadBalancer
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer." + rnd

resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -84,7 +83,7 @@ func TestAccCloudflareLoadBalancer_GeoBalanced(t *testing.T) {
t.Parallel()
var loadBalancer cloudflare.LoadBalancer
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer." + rnd

resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -113,7 +112,7 @@ func TestAccCloudflareLoadBalancer_GeoBalanced(t *testing.T) {
func TestAccCloudflareLoadBalancer_DuplicatePool(t *testing.T) {
t.Parallel()
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -137,7 +136,7 @@ func TestAccCloudflareLoadBalancer_Update(t *testing.T) {
var loadBalancer cloudflare.LoadBalancer
var initialId string
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer." + rnd

resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -179,7 +178,7 @@ func TestAccCloudflareLoadBalancer_CreateAfterManualDestroy(t *testing.T) {
var loadBalancer cloudflare.LoadBalancer
var initialId string
zone := os.Getenv("CLOUDFLARE_DOMAIN")
rnd := acctest.RandString(10)
rnd := generateRandomResourceName()
name := "cloudflare_load_balancer." + rnd

resource.Test(t, resource.TestCase{
Expand Down
14 changes: 7 additions & 7 deletions cloudflare/resource_cloudflare_page_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ func testAccCheckCloudflarePageRuleConfigMinify(zone, target string) string {
resource "cloudflare_page_rule" "test" {
zone = "%s"
target = "%s"
actions = {
actions {
minify {
js = "off"
css = "on"
Expand All @@ -452,7 +452,7 @@ func testAccCheckCloudflarePageRuleConfigBasic(zone, target string) string {
resource "cloudflare_page_rule" "test" {
zone = "%s"
target = "%s"
actions = {
actions {
always_online = "on"
ssl = "flexible"
}
Expand All @@ -464,7 +464,7 @@ func testAccCheckCloudflarePageRuleConfigNewValue(zone, target string) string {
resource "cloudflare_page_rule" "test" {
zone = "%s"
target = "%s/updated"
actions = {
actions {
always_online = "off"
browser_check = "on"
ssl = "strict"
Expand All @@ -478,7 +478,7 @@ func testAccCheckCloudflarePageRuleConfigFullySpecified(zone, target string) str
resource "cloudflare_page_rule" "test" {
zone = "%s"
target = "%s"
actions = {
actions {
always_online = "on"
browser_check = "on"
email_obfuscation = "on"
Expand All @@ -499,7 +499,7 @@ func testAccCheckCloudflarePageRuleConfigForwardingOnly(zone, target string) str
resource "cloudflare_page_rule" "test" {
zone = "%s"
target = "%s"
actions = {
actions {
// on/off options cannot even be set to off without causing error
forwarding_url {
url = "http://%[1]s/forward"
Expand All @@ -514,8 +514,8 @@ func testAccCheckCloudflarePageRuleConfigForwardingAndOthers(zone, target string
resource "cloudflare_page_rule" "test" {
zone = "%s"
target = "%s"
actions = {
disable_security = true
actions {
disable_security = true
forwarding_url {
url = "http://%[1]s/forward"
status_code = 301
Expand Down
Loading