@trautonen/cdk-dns-validated-certificate 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +25 -0
- package/.jsii +3894 -0
- package/.prettierignore +1 -0
- package/.prettierrc.json +7 -0
- package/.projenrc.ts +49 -0
- package/API.md +560 -0
- package/LICENSE +202 -0
- package/README.md +40 -0
- package/lib/dns-validated-certificate.d.ts +161 -0
- package/lib/dns-validated-certificate.js +179 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +18 -0
- package/lib/lambda/handler.d.ts +19 -0
- package/lib/lambda/handler.js +243 -0
- package/package.json +140 -0
package/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# ~~ Generated by projen. To modify, edit .projenrc.ts and run "npx projen".
|
package/.prettierrc.json
ADDED
package/.projenrc.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { awscdk } from 'projen'
|
|
2
|
+
import { NodePackageManager, NpmAccess, ProseWrap } from 'projen/lib/javascript'
|
|
3
|
+
|
|
4
|
+
const awsSdkVersion = '^3.0.0'
|
|
5
|
+
|
|
6
|
+
const project = new awscdk.AwsCdkConstructLibrary({
|
|
7
|
+
author: 'Tapio Rautonen',
|
|
8
|
+
authorAddress: 'trautonen@users.noreply.github.com',
|
|
9
|
+
cdkVersion: '2.83.1',
|
|
10
|
+
name: 'cdk-dns-validated-certificate',
|
|
11
|
+
packageName: '@trautonen/cdk-dns-validated-certificate',
|
|
12
|
+
description: 'CDK certificate construct that supports cross-region and cross-account DNS validation',
|
|
13
|
+
keywords: ['aws', 'cdk', 'dns', 'certificate', 'cross-region', 'cross-account'],
|
|
14
|
+
license: 'Apache-2.0',
|
|
15
|
+
|
|
16
|
+
repositoryUrl: 'https://github.com/trautonen/cdk-dns-validated-certificate.git',
|
|
17
|
+
defaultReleaseBranch: 'main',
|
|
18
|
+
jsiiVersion: '~5.0.0',
|
|
19
|
+
projenrcTs: true,
|
|
20
|
+
releaseToNpm: true,
|
|
21
|
+
npmAccess: NpmAccess.PUBLIC,
|
|
22
|
+
|
|
23
|
+
packageManager: NodePackageManager.NPM,
|
|
24
|
+
prettier: true,
|
|
25
|
+
prettierOptions: {
|
|
26
|
+
settings: {
|
|
27
|
+
printWidth: 120,
|
|
28
|
+
semi: false,
|
|
29
|
+
singleQuote: true,
|
|
30
|
+
proseWrap: ProseWrap.ALWAYS,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
devDeps: [
|
|
35
|
+
`@aws-sdk/client-acm@${awsSdkVersion}`,
|
|
36
|
+
`@aws-sdk/client-route-53@${awsSdkVersion}`,
|
|
37
|
+
`@aws-sdk/client-sts@${awsSdkVersion}`,
|
|
38
|
+
`@aws-sdk/types@${awsSdkVersion}`,
|
|
39
|
+
'@types/aws-lambda',
|
|
40
|
+
'aws-lambda',
|
|
41
|
+
'esbuild',
|
|
42
|
+
],
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
project.eslint?.addRules({
|
|
46
|
+
'import/no-extraneous-dependencies': ['error', { devDependencies: ['src/lambda/**/*.ts'] }],
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
project.synth()
|
package/API.md
ADDED
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
# AWS CDK DNS Validated Certificate
|
|
2
|
+
|
|
3
|
+
CDK does not have a built in construct to manage cross-region or cross-account DNS validated certificates. There's an attempt to work around the issue with a cross region references option for stacks, but it has a lot of issues and still does not solve the cross-account use case.
|
|
4
|
+
|
|
5
|
+
This construct solves these problems by managing the certificate as a custom resource and with direct API calls to ACM and Route53. In the future it will be possible to support not only Route53, but other DNS services too.
|
|
6
|
+
|
|
7
|
+
Currently there's a limitation which does not allow using alternative names for the certificate as it would require mapping of different roles to different hosted zones. This API is currently being developed.
|
|
8
|
+
|
|
9
|
+
## Usage for cross-region validation
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// hosted zone managed by the CDK application
|
|
13
|
+
const hostedZone: route53.IHostedZone = ...
|
|
14
|
+
// no separate validation role is needed
|
|
15
|
+
const certificate = new DnsValidatedCertificate(this, 'CrossRegionCertificate', {
|
|
16
|
+
hostedZone: hostedZone,
|
|
17
|
+
domainName: 'example.com', // must be compatible with the hosted zone
|
|
18
|
+
certificateRegion: 'us-east-1' // used by for example CloudFront
|
|
19
|
+
})
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage for cross-account validation
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// external hosted zone
|
|
26
|
+
const hostedZone: route53.IHostedZone = route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', {
|
|
27
|
+
hostedZoneId: 'Z532DGDEDFS123456789',
|
|
28
|
+
zoneName: 'example.com',
|
|
29
|
+
})
|
|
30
|
+
// validation role on the same account as the hosted zone
|
|
31
|
+
const roleArn = 'arn:aws:iam::123456789:role/ChangeDnsRecordsRole'
|
|
32
|
+
const externalId = 'domain-assume'
|
|
33
|
+
const validationRole: iam.IRole = iam.Role.fromRoleArn(this, 'ValidationRole', roleArn)
|
|
34
|
+
const certificate = new DnsValidatedCertificate(this, 'CrossAccountCertificate', {
|
|
35
|
+
hostedZone: hostedZone,
|
|
36
|
+
domainName: 'example.com',
|
|
37
|
+
validationRole: validationRole,
|
|
38
|
+
validationExternalId: externalId,
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
# API Reference <a name="API Reference" id="api-reference"></a>
|
|
43
|
+
|
|
44
|
+
## Constructs <a name="Constructs" id="Constructs"></a>
|
|
45
|
+
|
|
46
|
+
### DnsValidatedCertificate <a name="DnsValidatedCertificate" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate"></a>
|
|
47
|
+
|
|
48
|
+
- *Implements:* aws-cdk-lib.aws_certificatemanager.ICertificate, aws-cdk-lib.ITaggable
|
|
49
|
+
|
|
50
|
+
A certificate managed by AWS Certificate Manager.
|
|
51
|
+
|
|
52
|
+
Will be automatically validated using DNS validation against the
|
|
53
|
+
specified Route 53 hosted zone. This construct should be used only for cross-region or cross-account certificate
|
|
54
|
+
validations. The default ``Certificate`` construct is better in cases where everything is managed by the CDK
|
|
55
|
+
application.
|
|
56
|
+
|
|
57
|
+
Please note that this construct does not support alternative names yet as it would require domain to role mapping.
|
|
58
|
+
|
|
59
|
+
*Example*
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// # Cross-region certificate validation
|
|
63
|
+
// hosted zone managed by the CDK application
|
|
64
|
+
const hostedZone: route53.IHostedZone = ...
|
|
65
|
+
// no separate validation role is needed
|
|
66
|
+
const certificate = new DnsValidatedCertificate(this, 'CrossRegionCertificate', {
|
|
67
|
+
hostedZone: hostedZone,
|
|
68
|
+
domainName: 'example.com', // must be compatible with the hosted zone
|
|
69
|
+
certificateRegion: 'us-east-1' // used by for example CloudFront
|
|
70
|
+
})
|
|
71
|
+
// # Cross-account certificate validation
|
|
72
|
+
// external hosted zone
|
|
73
|
+
const hostedZone: route53.IHostedZone =
|
|
74
|
+
route53.HostedZone.fromHostedZoneAttributes(this, 'HostedZone', {
|
|
75
|
+
hostedZoneId: 'Z532DGDEDFS123456789',
|
|
76
|
+
zoneName: 'example.com'
|
|
77
|
+
})
|
|
78
|
+
// validation role on the same account as the hosted zone
|
|
79
|
+
const roleArn = 'arn:aws:iam::123456789:role/ChangeDnsRecordsRole'
|
|
80
|
+
const externalId = 'domain-assume'
|
|
81
|
+
const validationRole: iam.IRole =
|
|
82
|
+
iam.Role.fromRoleArn(this, 'ValidationRole', roleArn)
|
|
83
|
+
const certificate = new DnsValidatedCertificate(this, 'CrossAccountCertificate', {
|
|
84
|
+
hostedZone: hostedZone,
|
|
85
|
+
domainName: 'example.com',
|
|
86
|
+
validationRole: validationRole,
|
|
87
|
+
validationExternalId: externalId
|
|
88
|
+
})@resource[object Object]@resource[object Object]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
#### Initializers <a name="Initializers" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.Initializer"></a>
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { DnsValidatedCertificate } from '@trautonen/cdk-dns-validated-certificate'
|
|
96
|
+
|
|
97
|
+
new DnsValidatedCertificate(scope: Construct, id: string, props: DnsValidatedCertificateProps)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
| **Name** | **Type** | **Description** |
|
|
101
|
+
| --- | --- | --- |
|
|
102
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | construct hosting this construct. |
|
|
103
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.Initializer.parameter.id">id</a></code> | <code>string</code> | construct's identifier. |
|
|
104
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.Initializer.parameter.props">props</a></code> | <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps">DnsValidatedCertificateProps</a></code> | properties for the construct. |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.Initializer.parameter.scope"></a>
|
|
109
|
+
|
|
110
|
+
- *Type:* constructs.Construct
|
|
111
|
+
|
|
112
|
+
construct hosting this construct.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
##### `id`<sup>Required</sup> <a name="id" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.Initializer.parameter.id"></a>
|
|
117
|
+
|
|
118
|
+
- *Type:* string
|
|
119
|
+
|
|
120
|
+
construct's identifier.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
##### `props`<sup>Required</sup> <a name="props" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.Initializer.parameter.props"></a>
|
|
125
|
+
|
|
126
|
+
- *Type:* <a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps">DnsValidatedCertificateProps</a>
|
|
127
|
+
|
|
128
|
+
properties for the construct.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
133
|
+
|
|
134
|
+
| **Name** | **Description** |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
137
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
138
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.metricDaysToExpiry">metricDaysToExpiry</a></code> | Return the DaysToExpiry metric for this AWS Certificate Manager Certificate. By default, this is the minimum value over 1 day. |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
##### `toString` <a name="toString" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.toString"></a>
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
public toString(): string
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Returns a string representation of this construct.
|
|
149
|
+
|
|
150
|
+
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.applyRemovalPolicy"></a>
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
public applyRemovalPolicy(policy: RemovalPolicy): void
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Apply the given removal policy to this resource.
|
|
157
|
+
|
|
158
|
+
The Removal Policy controls what happens to this resource when it stops
|
|
159
|
+
being managed by CloudFormation, either because you've removed it from the
|
|
160
|
+
CDK application or because you've made a change that requires the resource
|
|
161
|
+
to be replaced.
|
|
162
|
+
|
|
163
|
+
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
|
|
164
|
+
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
165
|
+
|
|
166
|
+
###### `policy`<sup>Required</sup> <a name="policy" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.applyRemovalPolicy.parameter.policy"></a>
|
|
167
|
+
|
|
168
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
##### `metricDaysToExpiry` <a name="metricDaysToExpiry" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.metricDaysToExpiry"></a>
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
public metricDaysToExpiry(props?: MetricOptions): Metric
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Return the DaysToExpiry metric for this AWS Certificate Manager Certificate. By default, this is the minimum value over 1 day.
|
|
179
|
+
|
|
180
|
+
This metric is no longer emitted once the certificate has effectively
|
|
181
|
+
expired, so alarms configured on this metric should probably treat missing
|
|
182
|
+
data as "breaching".
|
|
183
|
+
|
|
184
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.metricDaysToExpiry.parameter.props"></a>
|
|
185
|
+
|
|
186
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
191
|
+
|
|
192
|
+
| **Name** | **Description** |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
195
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
196
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
##### ~~`isConstruct`~~ <a name="isConstruct" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isConstruct"></a>
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
import { DnsValidatedCertificate } from '@trautonen/cdk-dns-validated-certificate'
|
|
204
|
+
|
|
205
|
+
DnsValidatedCertificate.isConstruct(x: any)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Checks if `x` is a construct.
|
|
209
|
+
|
|
210
|
+
###### `x`<sup>Required</sup> <a name="x" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isConstruct.parameter.x"></a>
|
|
211
|
+
|
|
212
|
+
- *Type:* any
|
|
213
|
+
|
|
214
|
+
Any object.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
##### `isOwnedResource` <a name="isOwnedResource" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isOwnedResource"></a>
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
import { DnsValidatedCertificate } from '@trautonen/cdk-dns-validated-certificate'
|
|
222
|
+
|
|
223
|
+
DnsValidatedCertificate.isOwnedResource(construct: IConstruct)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Returns true if the construct was created by CDK, and false otherwise.
|
|
227
|
+
|
|
228
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isOwnedResource.parameter.construct"></a>
|
|
229
|
+
|
|
230
|
+
- *Type:* constructs.IConstruct
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
##### `isResource` <a name="isResource" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isResource"></a>
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
import { DnsValidatedCertificate } from '@trautonen/cdk-dns-validated-certificate'
|
|
238
|
+
|
|
239
|
+
DnsValidatedCertificate.isResource(construct: IConstruct)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Check whether the given construct is a Resource.
|
|
243
|
+
|
|
244
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.isResource.parameter.construct"></a>
|
|
245
|
+
|
|
246
|
+
- *Type:* constructs.IConstruct
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
251
|
+
|
|
252
|
+
| **Name** | **Type** | **Description** |
|
|
253
|
+
| --- | --- | --- |
|
|
254
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
255
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
256
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
257
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.certificateArn">certificateArn</a></code> | <code>string</code> | The certificate's ARN. |
|
|
258
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.certificateRegion">certificateRegion</a></code> | <code>string</code> | The region where the certificate is deployed to. |
|
|
259
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.domainName">domainName</a></code> | <code>string</code> | The domain name included in the certificate. |
|
|
260
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.hostedZoneId">hostedZoneId</a></code> | <code>string</code> | The hosted zone identifier authoritative for the certificate. |
|
|
261
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.hostedZoneName">hostedZoneName</a></code> | <code>string</code> | The hosted zone name authoritative for the certificate. |
|
|
262
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.tags">tags</a></code> | <code>aws-cdk-lib.TagManager</code> | The tag manager to set, remove and format tags for the certificate. |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
##### `node`<sup>Required</sup> <a name="node" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.node"></a>
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
public readonly node: Node;
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
- *Type:* constructs.Node
|
|
273
|
+
|
|
274
|
+
The tree node.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
##### `env`<sup>Required</sup> <a name="env" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.env"></a>
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
public readonly env: ResourceEnvironment;
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
- *Type:* aws-cdk-lib.ResourceEnvironment
|
|
285
|
+
|
|
286
|
+
The environment this resource belongs to.
|
|
287
|
+
|
|
288
|
+
For resources that are created and managed by the CDK
|
|
289
|
+
(generally, those created by creating new class instances like Role, Bucket, etc.),
|
|
290
|
+
this is always the same as the environment of the stack they belong to;
|
|
291
|
+
however, for imported resources
|
|
292
|
+
(those obtained from static methods like fromRoleArn, fromBucketName, etc.),
|
|
293
|
+
that might be different than the stack they were imported into.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
##### `stack`<sup>Required</sup> <a name="stack" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.stack"></a>
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
public readonly stack: Stack;
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
- *Type:* aws-cdk-lib.Stack
|
|
304
|
+
|
|
305
|
+
The stack in which this resource is defined.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
##### `certificateArn`<sup>Required</sup> <a name="certificateArn" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.certificateArn"></a>
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
public readonly certificateArn: string;
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
- *Type:* string
|
|
316
|
+
|
|
317
|
+
The certificate's ARN.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
##### `certificateRegion`<sup>Required</sup> <a name="certificateRegion" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.certificateRegion"></a>
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
public readonly certificateRegion: string;
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
- *Type:* string
|
|
328
|
+
|
|
329
|
+
The region where the certificate is deployed to.
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
##### `domainName`<sup>Required</sup> <a name="domainName" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.domainName"></a>
|
|
334
|
+
|
|
335
|
+
```typescript
|
|
336
|
+
public readonly domainName: string;
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
- *Type:* string
|
|
340
|
+
|
|
341
|
+
The domain name included in the certificate.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
##### `hostedZoneId`<sup>Required</sup> <a name="hostedZoneId" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.hostedZoneId"></a>
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
public readonly hostedZoneId: string;
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
- *Type:* string
|
|
352
|
+
|
|
353
|
+
The hosted zone identifier authoritative for the certificate.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
##### `hostedZoneName`<sup>Required</sup> <a name="hostedZoneName" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.hostedZoneName"></a>
|
|
358
|
+
|
|
359
|
+
```typescript
|
|
360
|
+
public readonly hostedZoneName: string;
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
- *Type:* string
|
|
364
|
+
|
|
365
|
+
The hosted zone name authoritative for the certificate.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
##### `tags`<sup>Required</sup> <a name="tags" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificate.property.tags"></a>
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
public readonly tags: TagManager;
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
- *Type:* aws-cdk-lib.TagManager
|
|
376
|
+
|
|
377
|
+
The tag manager to set, remove and format tags for the certificate.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## Structs <a name="Structs" id="Structs"></a>
|
|
383
|
+
|
|
384
|
+
### DnsValidatedCertificateProps <a name="DnsValidatedCertificateProps" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps"></a>
|
|
385
|
+
|
|
386
|
+
#### Initializer <a name="Initializer" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.Initializer"></a>
|
|
387
|
+
|
|
388
|
+
```typescript
|
|
389
|
+
import { DnsValidatedCertificateProps } from '@trautonen/cdk-dns-validated-certificate'
|
|
390
|
+
|
|
391
|
+
const dnsValidatedCertificateProps: DnsValidatedCertificateProps = { ... }
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
395
|
+
|
|
396
|
+
| **Name** | **Type** | **Description** |
|
|
397
|
+
| --- | --- | --- |
|
|
398
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.domainName">domainName</a></code> | <code>string</code> | Fully-qualified domain name to request a certificate for. |
|
|
399
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.hostedZone">hostedZone</a></code> | <code>aws-cdk-lib.aws_route53.IHostedZone</code> | Hosted zone to use for DNS validation. |
|
|
400
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.certificateRegion">certificateRegion</a></code> | <code>string</code> | AWS region where the certificate is deployed. |
|
|
401
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.cleanupValidationRecords">cleanupValidationRecords</a></code> | <code>boolean</code> | Enable or disable cleaning of validation DNS records from the hosted zone. |
|
|
402
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.customResourceRole">customResourceRole</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The role that is used for the custom resource Lambda execution. |
|
|
403
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.removalPolicy">removalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | Apply the given removal policy to this resource. |
|
|
404
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.transparencyLoggingEnabled">transparencyLoggingEnabled</a></code> | <code>boolean</code> | Enable or disable transparency logging for this certificate. |
|
|
405
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.validationExternalId">validationExternalId</a></code> | <code>string</code> | External id for ``validationRole`` role assume verification. |
|
|
406
|
+
| <code><a href="#@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.validationRole">validationRole</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The role that is assumed for DNS record changes for certificate validation. |
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
##### `domainName`<sup>Required</sup> <a name="domainName" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.domainName"></a>
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
public readonly domainName: string;
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
- *Type:* string
|
|
417
|
+
|
|
418
|
+
Fully-qualified domain name to request a certificate for.
|
|
419
|
+
|
|
420
|
+
May contain wildcards, such as ``*.domain.com``.
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
##### `hostedZone`<sup>Required</sup> <a name="hostedZone" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.hostedZone"></a>
|
|
425
|
+
|
|
426
|
+
```typescript
|
|
427
|
+
public readonly hostedZone: IHostedZone;
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
- *Type:* aws-cdk-lib.aws_route53.IHostedZone
|
|
431
|
+
|
|
432
|
+
Hosted zone to use for DNS validation.
|
|
433
|
+
|
|
434
|
+
If the hosted zone is not managed by the CDK application, it needs to be provided via
|
|
435
|
+
``HostedZone.fromHostedZoneAttributes()``.
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
##### `certificateRegion`<sup>Optional</sup> <a name="certificateRegion" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.certificateRegion"></a>
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
public readonly certificateRegion: string;
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
- *Type:* string
|
|
446
|
+
- *Default:* Same region as the stack.
|
|
447
|
+
|
|
448
|
+
AWS region where the certificate is deployed.
|
|
449
|
+
|
|
450
|
+
You should use the default ``Certificate`` construct instead if the region is same as the stack's and the hosted
|
|
451
|
+
zone is in the same account.
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
##### `cleanupValidationRecords`<sup>Optional</sup> <a name="cleanupValidationRecords" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.cleanupValidationRecords"></a>
|
|
456
|
+
|
|
457
|
+
```typescript
|
|
458
|
+
public readonly cleanupValidationRecords: boolean;
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
- *Type:* boolean
|
|
462
|
+
- *Default:* true
|
|
463
|
+
|
|
464
|
+
Enable or disable cleaning of validation DNS records from the hosted zone.
|
|
465
|
+
|
|
466
|
+
If there's multiple certificates created for same domain, it is possible to encouter a race condition where some
|
|
467
|
+
certificate is removed and another certificate would need the same validation record. Prefer single certificate
|
|
468
|
+
for a domain or set this to false and cleanup records manually when not needed anymore. If you change this
|
|
469
|
+
property after creation, a new certificate will be requested.
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
##### `customResourceRole`<sup>Optional</sup> <a name="customResourceRole" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.customResourceRole"></a>
|
|
474
|
+
|
|
475
|
+
```typescript
|
|
476
|
+
public readonly customResourceRole: IRole;
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
- *Type:* aws-cdk-lib.aws_iam.IRole
|
|
480
|
+
- *Default:* Lambda creates a default execution role.
|
|
481
|
+
|
|
482
|
+
The role that is used for the custom resource Lambda execution.
|
|
483
|
+
|
|
484
|
+
The role is given permissions to request certificates from ACM. If the ``validationRole`` is provided, this role
|
|
485
|
+
is also given permission to assume the ``validationRole``. Otherwise it is assumed that the hosted zone is in same
|
|
486
|
+
account and the execution role is given permissions to change DNS records for the given ``domainName``.
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
##### `removalPolicy`<sup>Optional</sup> <a name="removalPolicy" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.removalPolicy"></a>
|
|
491
|
+
|
|
492
|
+
```typescript
|
|
493
|
+
public readonly removalPolicy: RemovalPolicy;
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
497
|
+
- *Default:* RemovalPolicy.DESTROY
|
|
498
|
+
|
|
499
|
+
Apply the given removal policy to this resource.
|
|
500
|
+
|
|
501
|
+
The removal policy controls what happens to this resource when it stops being managed by CloudFormation, either
|
|
502
|
+
because you've removed it from the CDK application or because you've made a change that requires the resource to
|
|
503
|
+
be replaced. The resource can be deleted (``RemovalPolicy.DESTROY``), or left in your AWS account for data
|
|
504
|
+
recovery and cleanup later (``RemovalPolicy.RETAIN``). If you change this property after creation, a new
|
|
505
|
+
certificate will be requested.
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
##### `transparencyLoggingEnabled`<sup>Optional</sup> <a name="transparencyLoggingEnabled" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.transparencyLoggingEnabled"></a>
|
|
510
|
+
|
|
511
|
+
```typescript
|
|
512
|
+
public readonly transparencyLoggingEnabled: boolean;
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
- *Type:* boolean
|
|
516
|
+
- *Default:* true
|
|
517
|
+
|
|
518
|
+
Enable or disable transparency logging for this certificate.
|
|
519
|
+
|
|
520
|
+
Once a certificate has been logged, it cannot be removed from the log. Opting out at that point will have no
|
|
521
|
+
effect. If you change this property after creation, a new certificate will be requested.
|
|
522
|
+
|
|
523
|
+
> [https://docs.aws.amazon.com/acm/latest/userguide/acm-bestpractices.html#best-practices-transparency](https://docs.aws.amazon.com/acm/latest/userguide/acm-bestpractices.html#best-practices-transparency)
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
##### `validationExternalId`<sup>Optional</sup> <a name="validationExternalId" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.validationExternalId"></a>
|
|
528
|
+
|
|
529
|
+
```typescript
|
|
530
|
+
public readonly validationExternalId: string;
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
- *Type:* string
|
|
534
|
+
- *Default:* No external id provided during assume
|
|
535
|
+
|
|
536
|
+
External id for ``validationRole`` role assume verification.
|
|
537
|
+
|
|
538
|
+
This should be used only when ``validationRole`` is given and the role expects an external id provided on assume.
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
##### `validationRole`<sup>Optional</sup> <a name="validationRole" id="@trautonen/cdk-dns-validated-certificate.DnsValidatedCertificateProps.property.validationRole"></a>
|
|
543
|
+
|
|
544
|
+
```typescript
|
|
545
|
+
public readonly validationRole: IRole;
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
- *Type:* aws-cdk-lib.aws_iam.IRole
|
|
549
|
+
- *Default:* No separate role for DNS record changes. The given customResourceRole or the default role is used for DNS record changes.
|
|
550
|
+
|
|
551
|
+
The role that is assumed for DNS record changes for certificate validation.
|
|
552
|
+
|
|
553
|
+
This role should exist in the same account as the hosted zone and include permissions to change the DNS records
|
|
554
|
+
for the given ``hostedZone``. The ``customResourceRole`` or the default execution role is given permission to
|
|
555
|
+
assume this role.
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|