diff --git a/README.md b/README.md
index a992fdcc..4885ff4d 100644
--- a/README.md
+++ b/README.md
@@ -99,11 +99,14 @@ For a complete example, see [examples/complete](examples/complete).
For automated tests of the complete example using [bats](https://github.com/bats-core/bats-core) and [Terratest](https://github.com/gruntwork-io/terratest) (which tests and deploys the example on AWS), see [test](test).
+This will create a new s3 bucket `eg-prod-app` for a cloudfront cdn.
+
```hcl
module "cdn" {
source = "cloudposse/cloudfront-s3-cdn/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
+
namespace = "eg"
stage = "prod"
name = "app"
@@ -113,6 +116,21 @@ module "cdn" {
}
```
+This will reuse an existing s3 bucket `eg-prod-app` for a cloudfront cdn.
+
+```hcl
+module "cdn" {
+ source = "cloudposse/cloudfront-s3-cdn/aws"
+ # Cloud Posse recommends pinning every module to a specific version
+ # version = "x.x.x"
+
+ origin_bucket = "eg-prod-app"
+ aliases = ["assets.cloudposse.com"]
+ dns_alias_enabled = true
+ parent_zone_name = "cloudposse.com"
+}
+```
+
### Generating ACM Certificate
Use the AWS cli to [request new ACM certifiates](http://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request.html) (requires email validation)
@@ -252,7 +270,7 @@ Available targets:
| [name](#input\_name) | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
| [namespace](#input\_namespace) | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
| [ordered\_cache](#input\_ordered\_cache) | An ordered list of cache behaviors resource for this distribution. List from top to bottom in order of precedence. The topmost cache behavior will have precedence 0.
The fields can be described by the other variables in this file. For example, the field 'lambda\_function\_association' in this object has
a description in var.lambda\_function\_association variable earlier in this file. The only difference is that fields on this object are in ordered caches, whereas the rest
of the vars in this file apply only to the default cache. Put value `""` on field `target_origin_id` to specify default s3 bucket origin. |
list(object({| `[]` | no | -| [origin\_bucket](#input\_origin\_bucket) | Origin S3 bucket name | `string` | `null` | no | +| [origin\_bucket](#input\_origin\_bucket) | Name of an existing S3 bucket to use as the origin. If this is not provided, it will create a new s3 bucket using `var.name` and other context related inputs | `string` | `null` | no | | [origin\_force\_destroy](#input\_origin\_force\_destroy) | Delete all objects from the bucket so that the bucket can be destroyed without error (e.g. `true` or `false`) | `bool` | `false` | no | | [origin\_path](#input\_origin\_path) | An optional element that causes CloudFront to request your content from a directory in your Amazon S3 bucket or your custom origin. It must begin with a /. Do not add a / at the end of the path. | `string` | `""` | no | | [origin\_ssl\_protocols](#input\_origin\_ssl\_protocols) | The SSL/TLS protocols that you want CloudFront to use when communicating with your origin over HTTPS. | `list(string)` |
target_origin_id = string
path_pattern = string
allowed_methods = list(string)
cached_methods = list(string)
compress = bool
viewer_protocol_policy = string
min_ttl = number
default_ttl = number
max_ttl = number
forward_query_string = bool
forward_header_values = list(string)
forward_cookies = string
lambda_function_association = list(object({
event_type = string
include_body = bool
lambda_arn = string
}))
}))
[| no | @@ -438,8 +456,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply ### Contributors -| [![Erik Osterman][osterman_avatar]][osterman_homepage]
"TLSv1",
"TLSv1.1",
"TLSv1.2"
]
list(object({| `[]` | no | -| [origin\_bucket](#input\_origin\_bucket) | Origin S3 bucket name | `string` | `null` | no | +| [origin\_bucket](#input\_origin\_bucket) | Name of an existing S3 bucket to use as the origin. If this is not provided, it will create a new s3 bucket using `var.name` and other context related inputs | `string` | `null` | no | | [origin\_force\_destroy](#input\_origin\_force\_destroy) | Delete all objects from the bucket so that the bucket can be destroyed without error (e.g. `true` or `false`) | `bool` | `false` | no | | [origin\_path](#input\_origin\_path) | An optional element that causes CloudFront to request your content from a directory in your Amazon S3 bucket or your custom origin. It must begin with a /. Do not add a / at the end of the path. | `string` | `""` | no | | [origin\_ssl\_protocols](#input\_origin\_ssl\_protocols) | The SSL/TLS protocols that you want CloudFront to use when communicating with your origin over HTTPS. | `list(string)` |
target_origin_id = string
path_pattern = string
allowed_methods = list(string)
cached_methods = list(string)
compress = bool
viewer_protocol_policy = string
min_ttl = number
default_ttl = number
max_ttl = number
forward_query_string = bool
forward_header_values = list(string)
forward_cookies = string
lambda_function_association = list(object({
event_type = string
include_body = bool
lambda_arn = string
}))
}))
[| no | diff --git a/variables.tf b/variables.tf index 523ec579..72c1844b 100644 --- a/variables.tf +++ b/variables.tf @@ -43,7 +43,7 @@ variable "override_origin_bucket_policy" { variable "origin_bucket" { type = string default = null - description = "Origin S3 bucket name" + description = "Name of an existing S3 bucket to use as the origin. If this is not provided, it will create a new s3 bucket using `var.name` and other context related inputs" } variable "origin_path" {
"TLSv1",
"TLSv1.1",
"TLSv1.2"
]