diff --git a/README.md b/README.md
index ae2a5c0..81856c9 100644
--- a/README.md
+++ b/README.md
@@ -1,34 +1,6 @@
# AWS Static Website Terraform module
-This is a Terraform module to provision a static website using AWS S3 and CloudFront.
-
-## Requirements
-
-| Name | Version |
-|------|---------|
-| [terraform](#requirement\_terraform) | ~> 1.1.7 |
-| [aws](#requirement\_aws) | ~> 4.8.0 |
-
-## Providers
-
-| Name | Version |
-|------|---------|
-| [aws](#provider\_aws) | ~> 4.8.0 |
-| [random](#provider\_random) | ~> 3.1.2 |
-| [random](#provider\_cloudflare) | ~> 3.0 |
-
-## Inputs
-
-| Name | Description | Type | Default | Required |
-|------|-------------|------|---------|:--------:|
-| [name](#input\_name) | Name of the static website stacks, for example: my-website, my-website-staging, ashari.com, andi.ashari.me | `string` | | `true` |
-| [default_root_object](#input\_default\_root\_object) | Default root object to serve | `string` | `index.html` | `false` |
-| [default_not_found_page](#input\_default\_not\_found\_page) | Default not found page | `string` | `index.html` | `false` |
-| [default_tags](#input\_default\_tags) | Default tags to apply to all resources | `map(string)` | `{}` | `false` |
-| [custom_domain_provider](#input\_custom\_domain\_provider) | Custom domain provider name | `ENUM("CLOUDFLARE")` | | `false` |
-| [custom_domain_records](#input\_custom\_domain\_records) | Custom domain records name to use for CloudFront distribution | `list(string)` | `[]` | `yes, if custom_domain_provider is filled` |
-| [custom_domain_zone_id](#input\_custom\_domain\_zone\_id) | Domain Provider zone ID which custom domain is registered to | `string` | | `yes, if custom_domain_provider is filled` |
-| [cloudflare_api_token](#input\_cloudflare\_api\_token) | CloudFlare API token | `string` | | `yes, if custom_domain_provider=CLOUDFLARE` |
+This is a Terraform module to provision a static website using AWS S3 and CloudFront with optional custom domain ability
## Usage
@@ -58,5 +30,40 @@ module "static-website" {
```
The code above will provide an S3 bucket and Cloudfront Distribution serving static assets in an S3 bucket with additional ACM certificates for the custom domains assigned to Cloudfront and creating new records in the Cloudflare Zone
+## Requirements
+
+| Name | Version |
+|------|---------|
+| [terraform](#requirement\_terraform) | ~> 1.1.7 |
+| [aws](#requirement\_aws) | ~> 4.8.0 |
+
+## Providers
+
+| Name | Version |
+|------|---------|
+| [aws](#provider\_aws) | ~> 4.8.0 |
+| [random](#provider\_random) | ~> 3.1.2 |
+| [cloudflare](#provider\_cloudflare) | ~> 3.0 |
+
+## Inputs
+
+| Name | Description | Type | Default | Required |
+|------|-------------|------|---------|:--------:|
+| [name](#input\_name) | Name of the static website stacks.
For example: `my-website`, `my-website-staging`, `ashari.com`, `andi.ashari.me` | `string` | `""` | yes |
+| [default\_tags](#input\_default\_tags) | Default tags to apply to all resources | `map(string)` | `{}` | no |
+| [default\_root\_object](#input\_default\_root\_object) | Default root object to serve | `string` | `index.html` | no |
+| [default\_not\_found\_page](#input\_default\_not\_found\_page) | Default not found page | `string` | `index.html` | no |
+| [custom\_domain\_provider](#input\_custom\_domain\_provider) | Custom domain provider name.
Available values: `CLOUDFLARE` | `string` | `""` | no |
+| [custom\_domain\_records](#input\_custom\_domain\_records) | Custom domain records name to use for CloudFront distribution.
For example `["hello", "www.hello"]` which represent `hello.{{ROOT_DOMAIN}}` and `www.hello.{{ROOT_DOMAIN}}`, where `ROOT_DOMAIN` is coming from domain name from Zone provided in `custom_domain_zone_id` variable | `list(string)` | `[]` | yes if [custom\_domain\_provider](#input\_custom\_domain\_provider) is not empty |
+| [custom\_domain\_zone\_id](#input\_custom\_domain\_zone\_id) | Domain Provider zone ID which custom domain is registered to.
In Cloudflare this is called Zone Id, in Route53 this is called Hosted Zone Id | `string` | `""` | yes if [custom\_domain\_provider](#input\_custom\_domain\_provider) is not empty |
+| [cloudflare\_api\_token](#input\_cloudflare\_api\_token) | Cloudflare API token | `string` | `""` | yes if [custom\_domain\_provider](#input\_custom\_domain\_provider) is equal to `CLOUDFLARE` |
+
+## Outputs
+
+| Name | Description |
+|------|-------------|
+| [s3\_bucket\_name](#output\_s3\_bucket\_name) | S3 bucket name |
+| [cloudfront\_distribution\_domain\_name](#output\_cloudfront\_distribution\_domain\_name) | CloudFront distribution domain name |
+
## License
Apache 2 Licensed. See [LICENSE](https://github.com/aashari/terraform-aws-static-website/tree/master/LICENSE) for full details.
diff --git a/outputs.tf b/outputs.tf
new file mode 100644
index 0000000..8800114
--- /dev/null
+++ b/outputs.tf
@@ -0,0 +1,9 @@
+output "s3_bucket_name" {
+ value = aws_s3_bucket.this.bucket
+ description = "S3 bucket name"
+}
+
+output "cloudfront_distribution_domain_name" {
+ value = aws_cloudfront_distribution.this.domain_name
+ description = "CloudFront distribution domain name"
+}
diff --git a/variables.tf b/variables.tf
index 96568a1..7f421e1 100644
--- a/variables.tf
+++ b/variables.tf
@@ -42,5 +42,5 @@ variable "custom_domain_zone_id" {
variable "cloudflare_api_token" {
type = string
default = ""
- description = "CloudFlare API token"
+ description = "Cloudflare API token"
}