File tree Expand file tree Collapse file tree 5 files changed +116
-0
lines changed Expand file tree Collapse file tree 5 files changed +116
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : " Terraform Validation"
2
+ on :
3
+ - push
4
+ jobs :
5
+ example :
6
+ name : " Terraform"
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - name : " Checkout"
10
+ uses : actions/checkout@master
11
+ - name : " Format"
12
+ uses : hashicorp/terraform-github-actions@master
13
+ with :
14
+ tf_actions_version : 0.12.13
15
+ tf_actions_subcommand : " fmt"
16
+ tf_actions_working_dir : " ."
17
+ tf_actions_comment : true
18
+ env :
19
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
20
+ - name : " Init"
21
+ uses : hashicorp/terraform-github-actions@master
22
+ with :
23
+ tf_actions_version : 0.12.13
24
+ tf_actions_subcommand : " init"
25
+ tf_actions_working_dir : " ."
26
+ tf_actions_comment : true
27
+ env :
28
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
29
+ - name : " Validate"
30
+ uses : hashicorp/terraform-github-actions@master
31
+ with :
32
+ tf_actions_version : 0.12.13
33
+ tf_actions_subcommand : " validate"
34
+ tf_actions_working_dir : " ."
35
+ tf_actions_comment : true
36
+ env :
37
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38
+ TF_VAR_name : " name"
39
+ TF_VAR_hosted_zone : " hosted_zone"
40
+ TF_VAR_domain_name : " domain_name"
41
+ AWS_DEFAULT_REGION : " us-west-1"
Original file line number Diff line number Diff line change 1
1
# terraform-aws-acm-certificate
2
2
A Terraform module to create an Amazon Web Services (AWS) ACM certificate
3
+
4
+ ## Inputs
5
+
6
+ | Name | Description | Type | Default | Required |
7
+ | -------------------------- | ----------------------------------------------------------------------- | :----: | :------: | :------: |
8
+ | alternative\_ domain\_ names | Alternative domain names for which will be issued certificate | list | ` <list> ` | no |
9
+ | domain\_ name | Domain name for which will be issued certificate | string | n/a | yes |
10
+ | hosted\_ zone | Public hosted zone that will be used for certificate validation | string | n/a | yes |
11
+ | name | Name tag for the aws acm certificate | string | n/a | yes |
12
+ | tags | https://docs.aws.amazon.com/ARG/latest/userguide/tagging-resources.html | map | ` <map> ` | no |
13
+
14
+ ## Outputs
15
+
16
+ | Name | Description |
17
+ | ---- | --------------------- |
18
+ | arn | ACM certificate's arn |
Original file line number Diff line number Diff line change
1
+ data "aws_route53_zone" "default" {
2
+ name = " ${ var . hosted_zone } "
3
+ private_zone = false
4
+ }
5
+
6
+ resource "aws_acm_certificate" "default" {
7
+ domain_name = " ${ var . domain_name } "
8
+ validation_method = " DNS"
9
+ subject_alternative_names = " ${ concat (var. alternative_domain_names , list (format (" *.%s" , var. domain_name )))} "
10
+
11
+ tags = " ${ merge (
12
+ map (
13
+ " Name" , " ${ var . name } "
14
+ ),
15
+ " ${ var . tags } " )} "
16
+ }
17
+
18
+ resource "aws_route53_record" "default" {
19
+ name = " ${ aws_acm_certificate . default . domain_validation_options . 0 . resource_record_name } "
20
+ type = " ${ aws_acm_certificate . default . domain_validation_options . 0 . resource_record_type } "
21
+ zone_id = " ${ data . aws_route53_zone . default . id } "
22
+ records = [" ${ aws_acm_certificate . default . domain_validation_options . 0 . resource_record_value } " ]
23
+ ttl = 60
24
+ }
25
+
26
+ resource "aws_acm_certificate_validation" "default" {
27
+ certificate_arn = " ${ aws_acm_certificate . default . arn } "
28
+ validation_record_fqdns = [" ${ aws_route53_record . default . fqdn } " ]
29
+ }
Original file line number Diff line number Diff line change
1
+ output "arn" {
2
+ value = " ${ aws_acm_certificate . default . arn } "
3
+ description = " ACM certificate's arn"
4
+ }
Original file line number Diff line number Diff line change
1
+ variable "name" {
2
+ type = " string"
3
+ description = " Name tag for the aws acm certificate"
4
+ }
5
+
6
+ variable "hosted_zone" {
7
+ type = " string"
8
+ description = " Public hosted zone that will be used for certificate validation"
9
+ }
10
+
11
+ variable "domain_name" {
12
+ type = " string"
13
+ description = " Domain name for which will be issued certificate"
14
+ }
15
+
16
+ variable "alternative_domain_names" {
17
+ type = " list"
18
+ description = " Alternative domain names for which will be issued certificate"
19
+ default = []
20
+ }
21
+
22
+ variable "tags" {
23
+ type = " map"
24
+ description = " https://docs.aws.amazon.com/ARG/latest/userguide/tagging-resources.html"
25
+ default = {}
26
+ }
You can’t perform that action at this time.
0 commit comments