From 001917c78d02cf169357d49bd0fbd935c3d980cb Mon Sep 17 00:00:00 2001 From: Chris Hein Date: Tue, 26 Nov 2019 16:46:09 -0800 Subject: [PATCH] adding validation method using DNS Signed-off-by: Chris Hein --- Makefile | 16 ++++++++++++++-- README.md | 1 + serverless.template.yml | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a0c5f55..7ab0754 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,23 @@ -TEMPLATE=dist/aws-ecr-public.template.json +TEMPLATE ?= dist/aws-ecr-public.template.json +STACK_NAME ?= aws-ecr-public +VALIDATION_DOMAIN ?= "" +DOMAIN_NAME ?= "" +VALIDATION_METHOD ?= "EMAIL" + build: mkdir -p dist cfn-include -t -m serverless.template.yml > $(TEMPLATE) test: build - aws cloudformation deploy --template-file $(TEMPLATE) --stack-name aws-ecr-public --capabilities CAPABILITY_IAM + aws cloudformation deploy \ + --template-file $(TEMPLATE) \ + --stack-name $(STACK_NAME) \ + --capabilities CAPABILITY_IAM \ + --parameter-overrides \ + ValidationDomain=$(VALIDATION_DOMAIN) \ + DomainName=$(DOMAIN_NAME) \ + ValidationMethod=$(VALIDATION_METHOD) clean: rm -rf dist diff --git a/README.md b/README.md index 9c9ab42..db19e1f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ If you would like to make your registries publicly available then this solution | -- | -- | -- | | DomainName | No | If provided an ACM Certificate and API Domain Name will be created | ValidationDomain | No | Overwrite default Validation Domain for ACM Certificate +| ValidationMethod | Yes, *Default: EMAIL* | Allow you to use DNS instead of EMAIL for Certificate validation ## FAQ diff --git a/serverless.template.yml b/serverless.template.yml index ee6b9e5..f092f8b 100644 --- a/serverless.template.yml +++ b/serverless.template.yml @@ -11,6 +11,11 @@ Parameters: Type: String Default: '' Description: If provided an ACM Certificate and API Domain Name will be created + ValidationMethod: + Type: String + Default: 'EMAIL' + AllowedValues: ["EMAIL", "DNS"] + Description: If provided an ACM Certificate and API Domain Name will be created Conditions: HasValidationDomain: !Not [ !Equals [ !Ref ValidationDomain, '' ] ] @@ -76,6 +81,7 @@ Resources: Condition: HasDomainName Properties: DomainName: !Ref DomainName + ValidationMethod: !Ref ValidationMethod DomainValidationOptions: Fn::If: - HasValidationDomain