:zap::cloud: Serverless CloudFlare - Plugin to Create Record.
JavaScriptMIT
Installation
npm i -E serverless-cloudflare-dns
Features
- Auth with api token.
- Auth with email and key.
- Record Content Resolver. (useful for CloudFront)
- Create record on 'serverless deploy'.
- Remove record on 'serverless remove'.
- Command Line Support for c.r.u.d. operations.
Usage
# serverless.yml plugins:
- serverless-cloudflare-dnscustom:
cloudflare:
disabled: false # Optional, disabled this plugindomain: ""# Required, your.corp.domainauth:
# Option 1# email: "" # Required, use aws ssm or something like that# key: "" # Required, use aws ssm or something like that# Option 2# apiToken: "" # Required, use aws ssm or something like thatrecord:
name: ""# Required, subdomain.your.corp.domaincontent: "miapp.com"# Required, domain.to.redirectcontent: "#{cf:SomeOutput}"# CloudFormation Output Key.type: ""# Optional, default = CNAMEproxied: ""# Optional, default = trueproxiable: ""# Optional, default = true
Command Line support
$ sls cloudflare --help
$ sls cloudflare record deploy
$ sls cloudflare record update
$ sls cloudflare record remove
$ sls cloudflare record list
$ sls cloudflare record list -A
Flow
DEPLOY:
- if record does not exists => Create Record()
- if old cname content not equals to current => Update Record()
- if record exists => show message(): CF_RECORD_EXISTENTUPDATE:
- if record exists => Update Record()
- else => show message(): CF_RECORD_NOT_FOUNDREMOVE:
- if record exists => Remove Record()
- else => show message(): CF_RECORD_NOT_FOUND