Skip to content

Commit dd552b3

Browse files
Provide better description for var.origin_bucket (#142)
* Provide better description for var.origin_bucket * Auto Format * Update based on comments * Auto Format * Add example of reusing an s3 bucket * Auto Format * Correct naming order * Auto Format * Auto Format Co-authored-by: cloudpossebot <[email protected]>
1 parent 0d5b67e commit dd552b3

File tree

4 files changed

+45
-5
lines changed

4 files changed

+45
-5
lines changed

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ For a complete example, see [examples/complete](examples/complete).
9999

100100
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).
101101

102+
This will create a new s3 bucket `eg-prod-app` for a cloudfront cdn.
103+
102104
```hcl
103105
module "cdn" {
104106
source = "cloudposse/cloudfront-s3-cdn/aws"
105107
# Cloud Posse recommends pinning every module to a specific version
106108
# version = "x.x.x"
109+
107110
namespace = "eg"
108111
stage = "prod"
109112
name = "app"
@@ -113,6 +116,21 @@ module "cdn" {
113116
}
114117
```
115118

119+
This will reuse an existing s3 bucket `eg-prod-app` for a cloudfront cdn.
120+
121+
```hcl
122+
module "cdn" {
123+
source = "cloudposse/cloudfront-s3-cdn/aws"
124+
# Cloud Posse recommends pinning every module to a specific version
125+
# version = "x.x.x"
126+
127+
origin_bucket = "eg-prod-app"
128+
aliases = ["assets.cloudposse.com"]
129+
dns_alias_enabled = true
130+
parent_zone_name = "cloudposse.com"
131+
}
132+
```
133+
116134
### Generating ACM Certificate
117135

118136
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:
252270
| <a name="input_name"></a> [name](#input\_name) | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
253271
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
254272
| <a name="input_ordered_cache"></a> [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.<br>The fields can be described by the other variables in this file. For example, the field 'lambda\_function\_association' in this object has<br>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<br>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. | <pre>list(object({<br> target_origin_id = string<br> path_pattern = string<br><br> allowed_methods = list(string)<br> cached_methods = list(string)<br> compress = bool<br><br> viewer_protocol_policy = string<br> min_ttl = number<br> default_ttl = number<br> max_ttl = number<br><br> forward_query_string = bool<br> forward_header_values = list(string)<br> forward_cookies = string<br><br> lambda_function_association = list(object({<br> event_type = string<br> include_body = bool<br> lambda_arn = string<br> }))<br> }))</pre> | `[]` | no |
255-
| <a name="input_origin_bucket"></a> [origin\_bucket](#input\_origin\_bucket) | Origin S3 bucket name | `string` | `null` | no |
273+
| <a name="input_origin_bucket"></a> [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 |
256274
| <a name="input_origin_force_destroy"></a> [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 |
257275
| <a name="input_origin_path"></a> [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 |
258276
| <a name="input_origin_ssl_protocols"></a> [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)` | <pre>[<br> "TLSv1",<br> "TLSv1.1",<br> "TLSv1.2"<br>]</pre> | no |
@@ -438,8 +456,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
438456
### Contributors
439457

440458
<!-- markdownlint-disable -->
441-
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Jamie Nelson][Jamie-BitFlight_avatar]][Jamie-BitFlight_homepage]<br/>[Jamie Nelson][Jamie-BitFlight_homepage] | [![Clive Zagno][cliveza_avatar]][cliveza_homepage]<br/>[Clive Zagno][cliveza_homepage] | [![David Mattia][dmattia_avatar]][dmattia_homepage]<br/>[David Mattia][dmattia_homepage] |
442-
|---|---|---|---|---|
459+
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Jamie Nelson][Jamie-BitFlight_avatar]][Jamie-BitFlight_homepage]<br/>[Jamie Nelson][Jamie-BitFlight_homepage] | [![Clive Zagno][cliveza_avatar]][cliveza_homepage]<br/>[Clive Zagno][cliveza_homepage] | [![David Mattia][dmattia_avatar]][dmattia_homepage]<br/>[David Mattia][dmattia_homepage] | [![RB][nitrocode_avatar]][nitrocode_homepage]<br/>[RB][nitrocode_homepage] |
460+
|---|---|---|---|---|---|
443461
<!-- markdownlint-restore -->
444462

445463
[osterman_homepage]: https://github.com/osterman
@@ -452,6 +470,8 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
452470
[cliveza_avatar]: https://img.cloudposse.com/150x150/https://github.com/cliveza.png
453471
[dmattia_homepage]: https://github.com/dmattia
454472
[dmattia_avatar]: https://img.cloudposse.com/150x150/https://github.com/dmattia.png
473+
[nitrocode_homepage]: https://github.com/nitrocode
474+
[nitrocode_avatar]: https://img.cloudposse.com/150x150/https://github.com/nitrocode.png
455475

456476
[![README Footer][readme_footer_img]][readme_footer_link]
457477
[![Beacon][beacon]][website]

README.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@ usage: |-
6161
6262
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).
6363
64+
This will create a new s3 bucket `eg-prod-app` for a cloudfront cdn.
65+
6466
```hcl
6567
module "cdn" {
6668
source = "cloudposse/cloudfront-s3-cdn/aws"
6769
# Cloud Posse recommends pinning every module to a specific version
6870
# version = "x.x.x"
71+
6972
namespace = "eg"
7073
stage = "prod"
7174
name = "app"
@@ -75,6 +78,21 @@ usage: |-
7578
}
7679
```
7780
81+
This will reuse an existing s3 bucket `eg-prod-app` for a cloudfront cdn.
82+
83+
```hcl
84+
module "cdn" {
85+
source = "cloudposse/cloudfront-s3-cdn/aws"
86+
# Cloud Posse recommends pinning every module to a specific version
87+
# version = "x.x.x"
88+
89+
origin_bucket = "eg-prod-app"
90+
aliases = ["assets.cloudposse.com"]
91+
dns_alias_enabled = true
92+
parent_zone_name = "cloudposse.com"
93+
}
94+
```
95+
7896
### Generating ACM Certificate
7997
8098
Use the AWS cli to [request new ACM certifiates](http://docs.aws.amazon.com/acm/latest/userguide/gs-acm-request.html) (requires email validation)
@@ -116,3 +134,5 @@ contributors:
116134
github: "cliveza"
117135
- name: "David Mattia"
118136
github: "dmattia"
137+
- name: "RB"
138+
github: "nitrocode"

docs/terraform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
| <a name="input_name"></a> [name](#input\_name) | Solution name, e.g. 'app' or 'jenkins' | `string` | `null` | no |
9696
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | `string` | `null` | no |
9797
| <a name="input_ordered_cache"></a> [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.<br>The fields can be described by the other variables in this file. For example, the field 'lambda\_function\_association' in this object has<br>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<br>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. | <pre>list(object({<br> target_origin_id = string<br> path_pattern = string<br><br> allowed_methods = list(string)<br> cached_methods = list(string)<br> compress = bool<br><br> viewer_protocol_policy = string<br> min_ttl = number<br> default_ttl = number<br> max_ttl = number<br><br> forward_query_string = bool<br> forward_header_values = list(string)<br> forward_cookies = string<br><br> lambda_function_association = list(object({<br> event_type = string<br> include_body = bool<br> lambda_arn = string<br> }))<br> }))</pre> | `[]` | no |
98-
| <a name="input_origin_bucket"></a> [origin\_bucket](#input\_origin\_bucket) | Origin S3 bucket name | `string` | `null` | no |
98+
| <a name="input_origin_bucket"></a> [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 |
9999
| <a name="input_origin_force_destroy"></a> [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 |
100100
| <a name="input_origin_path"></a> [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 |
101101
| <a name="input_origin_ssl_protocols"></a> [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)` | <pre>[<br> "TLSv1",<br> "TLSv1.1",<br> "TLSv1.2"<br>]</pre> | no |

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ variable "override_origin_bucket_policy" {
4343
variable "origin_bucket" {
4444
type = string
4545
default = null
46-
description = "Origin S3 bucket name"
46+
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"
4747
}
4848

4949
variable "origin_path" {

0 commit comments

Comments
 (0)