github.com/andresvia/terraform@v0.6.15-0.20160412045437-d51c75946785/website/source/docs/providers/fastly/r/service_v1.html.markdown (about)

     1  ---
     2  layout: "fastly"
     3  page_title: "Fastly: aws_vpc"
     4  sidebar_current: "docs-fastly-resource-service-v1"
     5  description: |-
     6    Provides an Fastly Service
     7  ---
     8  
     9  # fastly\_service\_v1
    10  
    11  Provides a Fastly Service, representing the configuration for a website, app,
    12  api, or anything else to be served through Fastly. A Service encompasses Domains
    13  and Backends.
    14  
    15  The Service resource requires a domain name that is correctly set up to direct
    16  traffic to the Fastly service. See Fastly's guide on [Adding CNAME Records][fastly-cname]
    17  on their documentation site for guidance. 
    18  
    19  ## Example Usage
    20  
    21  Basic usage:
    22  
    23  ```
    24  resource "fastly_service_v1" "demo" {
    25    name = "demofastly"
    26  
    27    domain {
    28      name    = "demo.notexample.com"
    29      comment = "demo"
    30    }
    31  
    32    backend {
    33      address = "127.0.0.1"
    34      name    = "localhost"
    35      port    = 80
    36    }
    37  
    38    force_destroy = true
    39  }
    40  
    41  ```
    42  
    43  Basic usage with an Amazon S3 Website:
    44  
    45  ```
    46  resource "fastly_service_v1" "demo" {
    47    name = "demofastly"
    48  
    49    domain {
    50      name    = "demo.notexample.com"
    51      comment = "demo"
    52    }
    53  
    54    backend {
    55      address = "demo.notexample.com.s3-website-us-west-2.amazonaws.com"
    56      name    = "AWS S3 hosting"
    57      port    = 80
    58    }
    59  
    60    default_host = "${aws_s3_bucket.website.name}.s3-website-us-west-2.amazonaws.com"
    61  
    62    force_destroy = true
    63  }
    64  
    65  resource "aws_s3_bucket" "website" {
    66    bucket = "demo.notexample.com"
    67    acl    = "public-read"
    68  
    69    website {
    70      index_document = "index.html"
    71      error_document = "error.html"
    72    }
    73  }
    74  ```
    75  
    76  **Note:** For an AWS S3 Bucket, the Backend address is
    77  `<domain>.s3-website-<region>.amazonaws.com`. The `default_host` attribute
    78  should be set to `<bucket_name>.s3-website-<region>.amazonaws.com`. See the
    79  Fastly documentation on [Amazon S3][fastly-s3]
    80  
    81  ## Argument Reference
    82  
    83  The following arguments are supported:
    84  
    85  * `name` - (Required) The unique name for the Service to create
    86  * `domain` - (Required) A set of Domain names to serve as entry points for your
    87  Service. Defined below.
    88  * `backend` - (Required) A set of Backends to service requests from your Domains.
    89  Defined below.
    90  * `default_host` - (Optional) The default hostname
    91  * `default_ttl` - (Optional) The default Time-to-live (TTL) for requests
    92  * `force_destroy` - (Optional) Services that are active cannot be destroyed. In
    93  order to destroy the Service, set `force_destroy` to `true`. Default `false`.
    94  
    95  
    96  The `domain` block supports:
    97  
    98  * `name` - (Required) The domain that this Service will respond to
    99  * `comment` - (Optional) An optional comment about the Domain
   100  
   101  The `backend` block supports:
   102  
   103  * `name` - (Required, string) Name for this Backend. Must be unique to this Service
   104  * `address` - (Required, string) An IPv4, hostname, or IPv6 address for the Backend
   105  * `auto_loadbalance` - (Optional, boolean) Denote if this Backend should be
   106  included in the pool of backends that requests are load balanced against.
   107  Default `true`
   108  * `between_bytes_timeout` - (Optional) How long to wait between bytes in milliseconds. Default `10000`
   109  * `connect_timeout` - (Optional) How long to wait for a timeout in milliseconds.
   110  Default `1000`
   111  * `error_threshold` - (Optional) Number of errors to allow before the Backend is marked as down. Default `0`
   112  * `first_byte_timeout` - (Optional) How long to wait for the first bytes in milliseconds. Default `15000`
   113  * `max_conn` - (Optional) Maximum number of connections for this Backend.
   114  Default `200`
   115  * `port` - (Optional) The port number Backend responds on. Default `80`
   116  * `ssl_check_cert` - (Optional) Be strict on checking SSL certs. Default `true`
   117  * `weight` - (Optional) How long to wait for the first bytes in milliseconds.
   118  Default `100`
   119  
   120  ## Attributes Reference
   121  
   122  The following attributes are exported:
   123  
   124  * `id` - The ID of the Service
   125  * `name` – Name of this service
   126  * `active_version` - The currently active version of your Fastly Service
   127  * `domain` – Set of Domains. See above for details
   128  * `backend` – Set of Backends. See above for details
   129  * `default_host` – Default host specified
   130  * `default_ttl` - Default TTL
   131  * `force_destroy` - Force the destruction of the Service on delete
   132  
   133  
   134  [fastly-s3]: https://docs.fastly.com/guides/integrations/amazon-s3
   135  [fastly-cname]: https://docs.fastly.com/guides/basic-setup/adding-cname-records
   136