Created
August 13, 2019 01:13
-
-
Save andrepearce/653ed2673b43a19c6a9ab62e3042848d to your computer and use it in GitHub Desktop.
Certbot Route53 plugin AWS IAM Account & Policy CloudFormation Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Description: AWS IAM account & policy CloudFormation template for Certbot Route53 plugin | |
Parameters: | |
CertbotServiceUserName: | |
Type: String | |
Description: Certbot service user name | |
Default: service.certbot | |
AllowedPattern: \S+ | |
ConstraintDescription: Parameter requires at least one non-whitespace character | |
CertbotManagedHZ: | |
Type: String | |
Description: Hosted Zone ID pattern that the Certbot service account will be given access to | |
AllowedPattern: \S+ | |
ConstraintDescription: Parameter requires at least one non-whitespace character | |
Resources: | |
CertbotServiceUser: | |
Type: AWS::IAM::User | |
Properties: | |
UserName: !Ref CertbotServiceUserName | |
Policies: | |
- PolicyName: CertbotHostedZoneAccess | |
PolicyDocument: | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Action: | |
- route53:ListHostedZones | |
- route53:GetChange | |
Resource: | |
- '*' | |
- Effect: Allow | |
Action: | |
- route53:ChangeResourceRecordSets | |
Resource: | |
- !Sub 'arn:aws:route53:::hostedzone/${CertbotManagedHZ}' | |
CertbotAccessKey: | |
Type: AWS::IAM::AccessKey | |
DependsOn: CertbotServiceUser | |
Properties: | |
UserName: !Ref CertbotServiceUserName | |
Outputs: | |
CertbotAccessKeyId: | |
Description: Access Key ID for the Certbot service account | |
Value: !Ref CertbotAccessKey | |
CertbotSecretAccessKey: | |
Description: Secret Access Key for the Certbot service account | |
Value: !GetAtt CertbotAccessKey.SecretAccessKey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment