Skip to content

Commit 39d8c9b

Browse files
SweetOpsaknysh
authored andcommitted
Initial Implementation (#1)
* init code * Use TF `aws_acm_certificate` resources to request SSL certificate * Update `README` * Create `aws_route53_zone` only if `validation_method="DNS"`
1 parent 49745be commit 39d8c9b

File tree

8 files changed

+206
-2
lines changed

8 files changed

+206
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44

55
# Module directory
66
.terraform/
7+
.idea
8+
*.iml

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
addons:
2+
apt:
3+
packages:
4+
- git
5+
- make
6+
- curl
7+
8+
install:
9+
- make init
10+
11+
script:
12+
- make terraform/install
13+
- make terraform/get-plugins
14+
- make terraform/get-modules
15+
- make terraform/lint
16+
- make terraform/validate

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright {yyyy} {name of copyright owner}
189+
Copyright 2017-2018 Cloud Posse, LLC
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SHELL := /bin/bash
2+
3+
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
4+
5+
lint:
6+
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate

README.md

Lines changed: 118 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,118 @@
1-
# terraform-aws-acm-request
1+
# terraform-aws-acm-request-certificate [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-acm-request-certificate.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-acm-request-certificate)
2+
3+
Terraform module to request an ACM certificate for a domain name and create a CNAME record in the DNZ zone to complete certificate validation
4+
5+
6+
## Usage
7+
8+
```hcl
9+
module "acm_request_certificate" {
10+
source = "git::https://github.com/cloudposse/terraform-aws-acm-request-certificate.git?ref=master"
11+
domain_name = "example.com"
12+
proces_domain_validation_options = "true"
13+
ttl = "300"
14+
}
15+
```
16+
17+
18+
## Variables
19+
20+
| Name | Default | Description | Required |
21+
|:------------------------------------|:-------------|:-----------------------------------------------------------------------------------|:--------:|
22+
| `domain_name` | `` | A domain name for which the certificate should be issued | Yes |
23+
| `validation_method` | `DNS` | Which method to use for validation, `DNS` or `EMAIL` | No |
24+
| `proces_domain_validation_options` | `true` | Flag to enable/disable processing of the record to add to the DNS zone to complete certificate validation | No |
25+
| `ttl` | `300` | The TTL of the record to add to the DNS zone to complete certificate validation | No |
26+
| `tags` | `{}` | Additional tags (_e.g._ `map("BusinessUnit","XYZ")` | No |
27+
28+
29+
## Outputs
30+
31+
| Name | Description |
32+
|:-----------------------------|:-------------------------------------------------------------------------------|
33+
| `id` | The ARN of the certificate |
34+
| `arn` | The ARN of the certificate |
35+
| `domain_validation_options` | CNAME record that is added to the DNS zone to complete certificate validation |
36+
37+
38+
39+
## Help
40+
41+
**Got a question?**
42+
43+
File a GitHub [issue](https://github.com/cloudposse/terraform-aws-acm-request-certificate/issues), send us an [email](mailto:[email protected]) or reach out to us on [Gitter](https://gitter.im/cloudposse/).
44+
45+
46+
## Contributing
47+
48+
### Bug Reports & Feature Requests
49+
50+
Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-acm-request-certificate/issues) to report any bugs or file feature requests.
51+
52+
### Developing
53+
54+
If you are interested in being a contributor and want to get involved in developing `terraform-aws-acm-request-certificate`, we would love to hear from you! Shoot us an [email](mailto:[email protected]).
55+
56+
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
57+
58+
1. **Fork** the repo on GitHub
59+
2. **Clone** the project to your own machine
60+
3. **Commit** changes to your own branch
61+
4. **Push** your work back up to your fork
62+
5. Submit a **Pull request** so that we can review your changes
63+
64+
**NOTE:** Be sure to merge the latest from "upstream" before making a pull request!
65+
66+
67+
## License
68+
69+
[APACHE 2.0](LICENSE) © 2018 [Cloud Posse, LLC](https://cloudposse.com)
70+
71+
See [LICENSE](LICENSE) for full details.
72+
73+
Licensed to the Apache Software Foundation (ASF) under one
74+
or more contributor license agreements. See the NOTICE file
75+
distributed with this work for additional information
76+
regarding copyright ownership. The ASF licenses this file
77+
to you under the Apache License, Version 2.0 (the
78+
"License"); you may not use this file except in compliance
79+
with the License. You may obtain a copy of the License at
80+
81+
http://www.apache.org/licenses/LICENSE-2.0
82+
83+
Unless required by applicable law or agreed to in writing,
84+
software distributed under the License is distributed on an
85+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
86+
KIND, either express or implied. See the License for the
87+
specific language governing permissions and limitations
88+
under the License.
89+
90+
91+
## About
92+
93+
`terraform-aws-acm-request-certificate` is maintained and funded by [Cloud Posse, LLC][website].
94+
95+
![Cloud Posse](https://cloudposse.com/logo-300x69.png)
96+
97+
98+
Like it? Please let us know at <[email protected]>
99+
100+
We love [Open Source Software](https://github.com/cloudposse/)!
101+
102+
See [our other projects][community]
103+
or [hire us][hire] to help build your next cloud platform.
104+
105+
[website]: https://cloudposse.com/
106+
[community]: https://github.com/cloudposse/
107+
[hire]: https://cloudposse.com/contact/
108+
109+
110+
### Contributors
111+
112+
| [![Erik Osterman][erik_img]][erik_web]<br/>[Erik Osterman][erik_web] | [![Andriy Knysh][andriy_img]][andriy_web]<br/>[Andriy Knysh][andriy_web] |
113+
|-------------------------------------------------------|------------------------------------------------------------------|
114+
115+
[erik_img]: http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144
116+
[erik_web]: https://github.com/osterman/
117+
[andriy_img]: https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144
118+
[andriy_web]: https://github.com/aknysh/

main.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
resource "aws_acm_certificate" "default" {
2+
domain_name = "${var.domain_name}"
3+
validation_method = "${var.validation_method}"
4+
tags = "${var.tags}"
5+
}
6+
7+
data "aws_route53_zone" "default" {
8+
count = "${var.proces_domain_validation_options == "true" && var.validation_method == "DNS" ? 1 : 0}"
9+
name = "${var.domain_name}."
10+
private_zone = false
11+
}
12+
13+
locals {
14+
domain_validation_options = "${aws_acm_certificate.default.domain_validation_options[0]}"
15+
}
16+
17+
resource "aws_route53_record" "default" {
18+
count = "${var.proces_domain_validation_options == "true" && var.validation_method == "DNS" ? 1 : 0}"
19+
zone_id = "${data.aws_route53_zone.default.zone_id}"
20+
name = "${local.domain_validation_options["resource_record_name"]}"
21+
type = "${local.domain_validation_options["resource_record_type"]}"
22+
ttl = "${var.ttl}"
23+
records = ["${local.domain_validation_options["resource_record_value"]}"]
24+
}

outputs.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
output "id" {
2+
value = "${aws_acm_certificate.default.id}"
3+
}
4+
5+
output "arn" {
6+
value = "${aws_acm_certificate.default.arn}"
7+
}
8+
9+
output "domain_validation_options" {
10+
value = "${aws_acm_certificate.default.domain_validation_options}"
11+
}

variables.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
variable "domain_name" {
2+
type = "string"
3+
description = "A domain name for which the certificate should be issued"
4+
}
5+
6+
variable "validation_method" {
7+
type = "string"
8+
default = "DNS"
9+
description = "Which method to use for validation, DNS or EMAIL"
10+
}
11+
12+
variable "proces_domain_validation_options" {
13+
type = "string"
14+
default = "true"
15+
description = "Flag to enable/disable processing of the record to add to the DNS zone to complete certificate validation"
16+
}
17+
18+
variable "ttl" {
19+
type = "string"
20+
default = "300"
21+
description = "The TTL of the record to add to the DNS zone to complete certificate validation"
22+
}
23+
24+
variable "tags" {
25+
type = "map"
26+
default = {}
27+
description = "Additional tags (e.g. map('BusinessUnit`,`XYZ`)"
28+
}

0 commit comments

Comments
 (0)