Merge pull request #12025 from hashicorp/f-fastly-optional-backend

provider/fastly: Make Backends optional if used in VCL
This commit is contained in:
Clint 2017-02-17 10:23:29 -06:00 committed by GitHub
commit 5353515f5b
3 changed files with 19 additions and 13 deletions

View File

@ -109,7 +109,7 @@ func resourceServiceV1() *schema.Resource {
"backend": {
Type: schema.TypeSet,
Required: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
// required fields

View File

@ -82,11 +82,6 @@ resource "fastly_service_v1" "foo" {
comment = "tf-testing-domain"
}
backend {
address = "aws.amazon.com"
name = "amazon docs"
}
vcl {
name = "my_custom_main_vcl"
content = <<EOF
@ -99,6 +94,11 @@ sub vcl_recv {
return(lookup);
}
backend amazondocs {
.host = "127.0.0.1";
.port = "80";
}
EOF
main = true
}
@ -117,11 +117,6 @@ resource "fastly_service_v1" "foo" {
comment = "tf-testing-domain"
}
backend {
address = "aws.amazon.com"
name = "amazon docs"
}
vcl {
name = "my_custom_main_vcl"
content = <<EOF
@ -134,6 +129,11 @@ sub vcl_recv {
return(lookup);
}
backend amazondocs {
.host = "127.0.0.1";
.port = "80";
}
EOF
main = true
}
@ -144,6 +144,11 @@ EOF
sub vcl_error {
#FASTLY error
}
backend amazondocs {
.host = "127.0.0.1";
.port = "80";
}
EOF
}

View File

@ -132,8 +132,9 @@ The following arguments are supported:
* `name` - (Required) The unique name for the Service to create.
* `domain` - (Required) A set of Domain names to serve as entry points for your
Service. Defined below.
* `backend` - (Required) A set of Backends to service requests from your Domains.
Defined below.
* `backend` - (Optional) A set of Backends to service requests from your Domains.
Defined below. Backends must be defined in this argument, or defined in the
`vcl` argument below
* `condition` - (Optional) A set of conditions to add logic to any basic
configuration object in this service. Defined below.
* `cache_setting` - (Optional) A set of Cache Settings, allowing you to override