@infoxchange/make-it-so-sst-v2 3.0.1
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/.editorconfig +16 -0
- package/LICENSE +21 -0
- package/README.md +377 -0
- package/commitlint.config.ts +14 -0
- package/dist/cdk-constructs/IxApi.d.ts +12 -0
- package/dist/cdk-constructs/IxApi.d.ts.map +1 -0
- package/dist/cdk-constructs/IxApi.js +56 -0
- package/dist/cdk-constructs/IxBucket.d.ts +9 -0
- package/dist/cdk-constructs/IxBucket.d.ts.map +1 -0
- package/dist/cdk-constructs/IxBucket.js +22 -0
- package/dist/cdk-constructs/IxCertificate.d.ts +16 -0
- package/dist/cdk-constructs/IxCertificate.d.ts.map +1 -0
- package/dist/cdk-constructs/IxCertificate.js +26 -0
- package/dist/cdk-constructs/IxDnsRecord.d.ts +23 -0
- package/dist/cdk-constructs/IxDnsRecord.d.ts.map +1 -0
- package/dist/cdk-constructs/IxDnsRecord.js +43 -0
- package/dist/cdk-constructs/IxElasticache.d.ts +17 -0
- package/dist/cdk-constructs/IxElasticache.d.ts.map +1 -0
- package/dist/cdk-constructs/IxElasticache.js +70 -0
- package/dist/cdk-constructs/IxNextjsSite.d.ts +16 -0
- package/dist/cdk-constructs/IxNextjsSite.d.ts.map +1 -0
- package/dist/cdk-constructs/IxNextjsSite.js +38 -0
- package/dist/cdk-constructs/IxQuicksightWorkspace.d.ts +17 -0
- package/dist/cdk-constructs/IxQuicksightWorkspace.d.ts.map +1 -0
- package/dist/cdk-constructs/IxQuicksightWorkspace.js +29 -0
- package/dist/cdk-constructs/IxSESIdentity.d.ts +12 -0
- package/dist/cdk-constructs/IxSESIdentity.d.ts.map +1 -0
- package/dist/cdk-constructs/IxSESIdentity.js +45 -0
- package/dist/cdk-constructs/IxStaticSite.d.ts +17 -0
- package/dist/cdk-constructs/IxStaticSite.d.ts.map +1 -0
- package/dist/cdk-constructs/IxStaticSite.js +38 -0
- package/dist/cdk-constructs/IxVpcDetails.d.ts +12 -0
- package/dist/cdk-constructs/IxVpcDetails.d.ts.map +1 -0
- package/dist/cdk-constructs/IxVpcDetails.js +26 -0
- package/dist/cdk-constructs/IxWebsiteRedirect.d.ts +35 -0
- package/dist/cdk-constructs/IxWebsiteRedirect.d.ts.map +1 -0
- package/dist/cdk-constructs/IxWebsiteRedirect.js +72 -0
- package/dist/cdk-constructs/SiteOidcAuth/auth-check-handler-body.d.ts +2 -0
- package/dist/cdk-constructs/SiteOidcAuth/auth-check-handler-body.d.ts.map +1 -0
- package/dist/cdk-constructs/SiteOidcAuth/auth-check-handler-body.js +130 -0
- package/dist/cdk-constructs/SiteOidcAuth/auth-route.d.ts +2 -0
- package/dist/cdk-constructs/SiteOidcAuth/auth-route.d.ts.map +1 -0
- package/dist/cdk-constructs/SiteOidcAuth/auth-route.js +59 -0
- package/dist/cdk-constructs/SiteOidcAuth/index.d.ts +197 -0
- package/dist/cdk-constructs/SiteOidcAuth/index.d.ts.map +1 -0
- package/dist/cdk-constructs/SiteOidcAuth/index.js +188 -0
- package/dist/cdk-constructs/index.d.ts +11 -0
- package/dist/cdk-constructs/index.d.ts.map +1 -0
- package/dist/cdk-constructs/index.js +10 -0
- package/dist/deployConfig.d.ts +72 -0
- package/dist/deployConfig.d.ts.map +1 -0
- package/dist/deployConfig.js +78 -0
- package/dist/lib/auth/index.d.ts +2 -0
- package/dist/lib/auth/index.d.ts.map +1 -0
- package/dist/lib/auth/index.js +1 -0
- package/dist/lib/auth/oidc.d.ts +26 -0
- package/dist/lib/auth/oidc.d.ts.map +1 -0
- package/dist/lib/auth/oidc.js +48 -0
- package/dist/lib/proxy/fetch.d.ts +4 -0
- package/dist/lib/proxy/fetch.d.ts.map +1 -0
- package/dist/lib/proxy/fetch.js +31 -0
- package/dist/lib/proxy/index.d.ts +2 -0
- package/dist/lib/proxy/index.d.ts.map +1 -0
- package/dist/lib/proxy/index.js +1 -0
- package/dist/lib/site/support.d.ts +71 -0
- package/dist/lib/site/support.d.ts.map +1 -0
- package/dist/lib/site/support.js +262 -0
- package/dist/lib/utils/hash.d.ts +2 -0
- package/dist/lib/utils/hash.d.ts.map +1 -0
- package/dist/lib/utils/hash.js +13 -0
- package/dist/lib/utils/objects.d.ts +4 -0
- package/dist/lib/utils/objects.d.ts.map +1 -0
- package/dist/lib/utils/objects.js +7 -0
- package/eslint.config.js +11 -0
- package/package.json +66 -0
- package/src/cdk-constructs/IxApi.ts +81 -0
- package/src/cdk-constructs/IxBucket.ts +35 -0
- package/src/cdk-constructs/IxCertificate.ts +54 -0
- package/src/cdk-constructs/IxDnsRecord.ts +79 -0
- package/src/cdk-constructs/IxElasticache.ts +106 -0
- package/src/cdk-constructs/IxNextjsSite.ts +72 -0
- package/src/cdk-constructs/IxQuicksightWorkspace.ts +54 -0
- package/src/cdk-constructs/IxSESIdentity.ts +70 -0
- package/src/cdk-constructs/IxStaticSite.ts +69 -0
- package/src/cdk-constructs/IxVpcDetails.ts +38 -0
- package/src/cdk-constructs/IxWebsiteRedirect.ts +133 -0
- package/src/cdk-constructs/SiteOidcAuth/auth-check-handler-body.ts +168 -0
- package/src/cdk-constructs/SiteOidcAuth/auth-route.ts +71 -0
- package/src/cdk-constructs/SiteOidcAuth/index.ts +299 -0
- package/src/cdk-constructs/index.ts +10 -0
- package/src/deployConfig.ts +87 -0
- package/src/lib/auth/index.ts +1 -0
- package/src/lib/auth/oidc.ts +73 -0
- package/src/lib/proxy/fetch.ts +41 -0
- package/src/lib/proxy/index.ts +1 -0
- package/src/lib/site/support.ts +439 -0
- package/src/lib/utils/hash.ts +14 -0
- package/src/lib/utils/objects.ts +19 -0
- package/tsconfig.json +9 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
end_of_line = lf
|
|
5
|
+
charset = utf-8
|
|
6
|
+
|
|
7
|
+
[{*.js,*.json,*.ts,*.md,*.yml,*.yaml}]
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 2
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
|
|
13
|
+
[*.js]
|
|
14
|
+
block_comment_start = /**
|
|
15
|
+
block_comment = *
|
|
16
|
+
block_comment_end = */
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Callum Gare
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# Make It So (for SST v2 - see main branch for SST v3 support)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@infoxchange/make-it-so-sst-v2)
|
|
4
|
+
|
|
5
|
+
A helpful little library that allows you to deploy apps on Infoxchange's (IX) infrastructure without having to specify all the implementation details that are specific to IX's deployment environment. You tell it what you want and it will worry about making it happen. Most of the heavily lifting is done by [SST (version 2)](https://v2.sst.dev/what-is-sst) which is extending to take care the IX related specifics.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
# NPM
|
|
11
|
+
npm --save-dev @infoxchange/make-it-so-sst-v2
|
|
12
|
+
# Yarn
|
|
13
|
+
yarn add --dev @infoxchange/make-it-so-sst-v2
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
### deployConfig
|
|
19
|
+
|
|
20
|
+
The IX pipeline provides certain information about the deployment currently in progress via environment variables. deployConfig gives you a friendly (and typed) way to access these details.
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import deployConfig, {
|
|
24
|
+
getDeployConfig,
|
|
25
|
+
} from "@infoxchange/make-it-so-sst-v2/deployConfig";
|
|
26
|
+
|
|
27
|
+
if (deployConfig.isIxDeploy) {
|
|
28
|
+
console.log(
|
|
29
|
+
`Deploying ${deployConfig.appName} into ${deployConfig.environment}`,
|
|
30
|
+
);
|
|
31
|
+
} else {
|
|
32
|
+
console.log(`Not deploying via the IX deploy pipeline`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Will return the same object but calculated when the function is run rather than when imported. Useful if any IX
|
|
36
|
+
// deployment related environment variables are changed at runtime.
|
|
37
|
+
console.log(getDeployConfig());
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><strong>Full list of available deployment properties</strong></summary>
|
|
42
|
+
|
|
43
|
+
| Name | Description | Type for IX Deploy | Type for non-IX Deploy |
|
|
44
|
+
| ----------------- | -------------------------------------- | ---------------------------------- | ---------------------- |
|
|
45
|
+
| isIxDeploy | Is deploying via IX pipeline or not | true | false |
|
|
46
|
+
| appName | Name of app being deployed | string | string |
|
|
47
|
+
| environment | Name of env app is being deployed to | "dev" \| "test" \| "uat" \| "prod" | string |
|
|
48
|
+
| workloadGroup | The workload group of the app | "ds" \| "srs" | string |
|
|
49
|
+
| primaryAwsRegion | AWS Region used by IX | "ap-southeast-2" | string |
|
|
50
|
+
| siteDomains | Domains for the app to use | string[] | string[] |
|
|
51
|
+
| siteDomainAliases | Domains to be redirected to primary | string[] | string[] |
|
|
52
|
+
| isInternalApp | If app is for internal usage | boolean | boolean \| undefined |
|
|
53
|
+
| deploymentType | What pipeline type is being used | "docker" \| "serverless" | string |
|
|
54
|
+
| sourceCommitRef | The git commit ref of deployed code | string | string |
|
|
55
|
+
| sourceCommitHash | The git commit hash of deployed code | string | string |
|
|
56
|
+
| deployTriggeredBy | Config commit id that triggered deploy | string | string |
|
|
57
|
+
| smtpHost | SMTP host for the app to use | string | string |
|
|
58
|
+
| smtpPort | SMTP port for the app to use | number | number \| undefined |
|
|
59
|
+
| clamAVUrl | ClamAV instance url for the app to use | string | string |
|
|
60
|
+
|
|
61
|
+
</details>
|
|
62
|
+
|
|
63
|
+
### CDK Constructs
|
|
64
|
+
|
|
65
|
+
<details>
|
|
66
|
+
<summary><strong>IxNextjsSite</strong> - Deploys a serverless instance of a Next.js.</summary>
|
|
67
|
+
|
|
68
|
+
IxNextjsSite extends [SST's NextjsSite](https://v2.sst.dev/constructs/NextjsSite) with a few minor changes to the props
|
|
69
|
+
and behaviour.
|
|
70
|
+
|
|
71
|
+
If the `customDomain` prop is not set then the first site domain provided by the IX deployment pipeline will be used as the primary custom domain, any additional domains (if there are any) will be used as alternative domain names and the first pipeline provided domain alias domain will be used will be used as a domain alias. This behaviour of setting pipeline configuring custom domains can be avoided by providing a value for `customDomain` (including explicitly setting it to `undefined` which will ensure no customDomain is used).
|
|
72
|
+
|
|
73
|
+
If `isIxManagedDomain` is true (which is the case if `customDomain` is set automatically using pipeline provided values) and no custom certificate is given then one will be created for any custom domains given (including alternative domain names which the base SST construct doesn't currently do).
|
|
74
|
+
|
|
75
|
+
Also if `isIxManagedDomain` is true DNS records will be automatically created for them.
|
|
76
|
+
|
|
77
|
+
It will also automatically attach the site to the standard IX VPC created in each workload account (unless you
|
|
78
|
+
explicitly pass other VPC details or set the VPC-related props (see the SST doco) to `undefined`) and set the env vars
|
|
79
|
+
`HTTP_PROXY`, `http_proxy`, `HTTPS_PROXY` and `https_proxy` to the HTTP Proxy for the VPC.
|
|
80
|
+
|
|
81
|
+
Unlike [NextjsSite](https://v2.sst.dev/constructs/NextjsSite), any environment variables set with `stackOrApp.setDefaultFunctionProps()` or
|
|
82
|
+
`stackOrApp.addDefaultFunctionEnv()` will be inherited by the IxNextjsSite lambda functions.
|
|
83
|
+
|
|
84
|
+
#### Options:
|
|
85
|
+
|
|
86
|
+
| Prop | Type | Description |
|
|
87
|
+
| ------------------------------------ | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| [...NextjsSiteProps] | | Any props accepted by [SST's NextjsSite](https://v2.sst.dev/constructs/NextjsSite) |
|
|
89
|
+
| customDomain.isIxManagedDomain | boolean | (optional) If true will attempt to create DNS records and certs for it using the IX shared infra. Only required if explicitly setting customDomains and you want DNS records + certs setup for them |
|
|
90
|
+
| customDomain.additionalDomainAliases | string[] | (optional) Works like `customDomain.domainAlias` but `domainAlias` only allows one domain, additionalDomainAliases allows setting additional domains |
|
|
91
|
+
| environment | Record<string, string \| {buildtime?: string, runtime?: string}> | (optional) As well as accepting strings for environment variable values as is already done by [NextjsSite](https://v2.sst.dev/constructs/NextjsSite) it also accepts an object with the properties `buildtime` and/or `runtime` which allows you to customise the environment variable value during those different steps. |
|
|
92
|
+
| auth | object | (optional) If provided will put the site behind auth. |
|
|
93
|
+
| auth.oidc | object | |
|
|
94
|
+
| auth.oidc.issuerUrl | string | An issuer URL for the OIDC server to use. |
|
|
95
|
+
| auth.oidc.clientId | string | The OIDC client ID to use. |
|
|
96
|
+
| auth.oidc.scope | string | The scope used for the auth request. |
|
|
97
|
+
| auth.prefix | string | (optional) A custom path to be used for the auth route. |
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { IxNextjsSite } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
101
|
+
|
|
102
|
+
const site = new IxNextjsSite(stack, "Site", {
|
|
103
|
+
environment: {
|
|
104
|
+
DATABASE_URL: process.env.DATABASE_URL || "",
|
|
105
|
+
SESSION_SECRET: process.env.SESSION_SECRET || "",
|
|
106
|
+
},
|
|
107
|
+
// The default behaviour is the same as if you included:
|
|
108
|
+
// customDomain: {
|
|
109
|
+
// domainName: ixDeployConfig.siteDomains[0],
|
|
110
|
+
// alternateNames: ixDeployConfig.siteDomains.slice(1)
|
|
111
|
+
// },
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
</details>
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary><strong>IxStaticSite</strong> - Deploys a static site.</summary>
|
|
119
|
+
|
|
120
|
+
IxNextjsSite extends [SST's StaticSite](https://v2.sst.dev/constructs/StaticSite) and takes the same props with the addition of `isIxManagedDomain` in the `customDomain` property.
|
|
121
|
+
|
|
122
|
+
If the props `customDomain` is not set then the first site domain provided by the IX deployment pipeline will be used as the primary custom domain, any additional domains (if there are any) will be used as alternative domain names and the first pipeline provided domain alias domain will be used will be used as a domain alias. This behaviour of setting pipeline configuring custom domains can be avoided by providing a value for `customDomain` (including explicitly setting it to `undefined` which will ensure no customDomain is used).
|
|
123
|
+
|
|
124
|
+
If `isIxManagedDomain` is true (which is the case if `customDomain` is set automatically using pipeline provided values) and no custom certificate is given then one will be created for any custom domains given (including alternative domain names which the base SST construct doesn't currently do).
|
|
125
|
+
|
|
126
|
+
Also if `isIxManagedDomain` is true DNS records will be automatically created for them.
|
|
127
|
+
|
|
128
|
+
#### Options:
|
|
129
|
+
|
|
130
|
+
| Prop | Type | Description |
|
|
131
|
+
| ------------------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
132
|
+
| [...StaticSiteProps] | | Any props accepted by [SST's StaticSite](https://v2.sst.dev/constructs/StaticSite) |
|
|
133
|
+
| customDomain.isIxManagedDomain | boolean | (optional) If true will attempt to create DNS records and certs for it using the IX shared infra. Only required if explicitly setting customDomains and you want DNS records + certs setup for them |
|
|
134
|
+
| customDomain.additionalDomainAliases | string[] | (optional) Works like `customDomain.domainAlias` but `domainAlias` only allows one domain, additionalDomainAliases allows setting additional domains |
|
|
135
|
+
| auth | object | (optional) If provided will put the site behind auth. |
|
|
136
|
+
| auth.oidc | object | |
|
|
137
|
+
| auth.oidc.issuerUrl | string | An issuer URL for the OIDC server to use. |
|
|
138
|
+
| auth.oidc.clientId | string | The OIDC client ID to use. |
|
|
139
|
+
| auth.oidc.scope | string | The scope used for the auth request. |
|
|
140
|
+
| auth.prefix | string | (optional) A custom path to be used for the auth route. |
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { IxStaticSite } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
144
|
+
|
|
145
|
+
const site = new IxStaticSite(stack, "Site", {
|
|
146
|
+
environment: {
|
|
147
|
+
DOOHICKEY_NAME: process.env.DOOHICKEY_NAME || "",
|
|
148
|
+
},
|
|
149
|
+
// The default behaviour is the same as if you included:
|
|
150
|
+
// customDomain: {
|
|
151
|
+
// domainName: ixDeployConfig.siteDomains[0],
|
|
152
|
+
// alternateNames: ixDeployConfig.siteDomains.slice(1)
|
|
153
|
+
// },
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
</details>
|
|
158
|
+
|
|
159
|
+
<details>
|
|
160
|
+
<summary><strong>IxApi</strong> - Deploys an instance of API Gateway.</summary>
|
|
161
|
+
|
|
162
|
+
IxApi extends [SST's Api](https://v2.sst.dev/constructs/Api) and takes the exact same props.
|
|
163
|
+
|
|
164
|
+
It will automatically create certificates and DNS records for a single domain that the API should deploy to. If the props `customDomain` is not set the first site domain provided by the IX deployment pipeline will be used as the domain. Explicitly setting `customDomain` to `undefined` will ensure no customDomain is used. Regardless of if a custom domain is set, the API Gateway will still be accessible via the 'api-id.execute-api.region.amazonaws.com' url.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { IxApi } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
168
|
+
|
|
169
|
+
const site = new IxApi(stack, "api", {
|
|
170
|
+
// The default behaviour is the same as if you included:
|
|
171
|
+
// customDomain: {
|
|
172
|
+
// domainName: ixDeployConfig.siteDomains[0],
|
|
173
|
+
// },
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
</details>
|
|
178
|
+
|
|
179
|
+
<details>
|
|
180
|
+
<summary><strong>IxElasticache</strong> - Deploys an AWS Elasticache cluster, either the redis or the memcached flavour.</summary>
|
|
181
|
+
|
|
182
|
+
It will also automatically attach the cluster to the standard IX VPC created in each workload account (unless you explicitly pass a different VPC to be attached with the vpc prop or set the vpc prop to `undefined` which will stop any VPC being attached).
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
import { IxElasticache } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
186
|
+
|
|
187
|
+
const redisCluster = new IxElasticache(stack, "elasticache", {
|
|
188
|
+
autoMinorVersionUpgrade: true,
|
|
189
|
+
cacheNodeType: "cache.t2.small",
|
|
190
|
+
engine: "redis",
|
|
191
|
+
numCacheNodes: 1,
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### Options:
|
|
196
|
+
|
|
197
|
+
| Prop | Type | Description |
|
|
198
|
+
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
199
|
+
| vpc | IVpc | (optional) A VPC to attach if not using default IX VPC |
|
|
200
|
+
| vpcSubnetIds | string[] | (optional) List of IDs of subnets to be used if not using default IX VPC subnets |
|
|
201
|
+
| [...CfnCacheClusterProps] | | Any props accepted by [CfnCacheCluster](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_elasticache.CfnCacheCluster.html#construct-props) |
|
|
202
|
+
|
|
203
|
+
#### Properties:
|
|
204
|
+
|
|
205
|
+
| Properties | Type | Description |
|
|
206
|
+
| ---------------- | --------------- | ---------------------------------------------------------------- |
|
|
207
|
+
| connectionString | string | A string with all the details required to connect to the cluster |
|
|
208
|
+
| cluster | CfnCacheCluster | An AWS CDK CfnCacheCluster instance |
|
|
209
|
+
|
|
210
|
+
</details>
|
|
211
|
+
|
|
212
|
+
<details>
|
|
213
|
+
<summary><strong>IxCertificate</strong> - Creates a new DNS validated ACM certificate for a domain managed by IX.</summary>
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import { IxCertificate } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
217
|
+
|
|
218
|
+
const domainCert = new IxCertificate(scope, "ExampleDotComCertificate", {
|
|
219
|
+
domainName: "example.com",
|
|
220
|
+
subjectAlternativeNames: ["other-domain.com"],
|
|
221
|
+
region: "us-east-1",
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Options:
|
|
226
|
+
|
|
227
|
+
| Prop | Type | Description |
|
|
228
|
+
| ----------------------- | -------- | --------------------------------------------------------------- |
|
|
229
|
+
| domainName | string | Domain name for cert |
|
|
230
|
+
| subjectAlternativeNames | string[] | (optional) Any domains for the certs "Subject Alternative Name" |
|
|
231
|
+
| region | string | (optional) The AWS region to create the cert in |
|
|
232
|
+
|
|
233
|
+
</details>
|
|
234
|
+
|
|
235
|
+
<details>
|
|
236
|
+
<summary><strong>IxDnsRecord</strong> - Creates a DNS record for a domain managed by IX.</summary>
|
|
237
|
+
|
|
238
|
+
Route53 HostedZones for IX managed domains live in the dns-hosting AWS account so if a workload AWS account requires a DNS record to be created this must be done "cross-account". IxDnsRecord handles that part for you. Just give it the details for the DNS record itself and IxDnsRecord will worry about creating it.
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { IxDnsRecord } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
242
|
+
|
|
243
|
+
new IxDnsRecord(scope, "IxDnsRecord", {
|
|
244
|
+
type: "A",
|
|
245
|
+
name: "example.com",
|
|
246
|
+
value: "1.1.1.1",
|
|
247
|
+
ttl: 900,
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Options:
|
|
252
|
+
|
|
253
|
+
| Prop | Type | Description |
|
|
254
|
+
| ------------ | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
255
|
+
| type | "A" \| "CNAME" \| "NS" \| "SOA" \| "ALIAS" \| "TXT" \| "MX" | DNS record type |
|
|
256
|
+
| name | string | DNS record FQDN |
|
|
257
|
+
| value | string | DNS record value |
|
|
258
|
+
| ttl | number | (optional) TTL value for DNS record |
|
|
259
|
+
| hostedZoneId | string | (optional) The ID of the Route53 HostedZone belonging to the dns-hosting account in which to create the DNS record. If not given the correct HostedZone will be inferred from the domain in the "value" prop. |
|
|
260
|
+
| aliasZoneId | string | (only needed if type = "Alias") the Route53 HostedZone that the target of the alias record lives in. Generally this will be the well known ID of a HostedZone for a AWS service itself that is managed by AWS, not an end-user. |
|
|
261
|
+
| priority | number | (only needed if type = "MX") The priority level of the MX record. |
|
|
262
|
+
|
|
263
|
+
</details>
|
|
264
|
+
|
|
265
|
+
<details>
|
|
266
|
+
<summary><strong>IxSESIdentity</strong> - Creates an SES domain identity for a domain managed by IX.</summary>
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
import { IxSESIdentity } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
270
|
+
|
|
271
|
+
new IxSESIdentity(scope, "IxSESIdentity", {
|
|
272
|
+
// Email identity domain will be: example.dev.ixapps.org
|
|
273
|
+
// Custom mail from domain will be: info.example.dev.ixapps.org
|
|
274
|
+
domain: "example.dev.ixapps.org",
|
|
275
|
+
mailFromSubdomain: "info", // optional, "mail" will be used otherwise
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### Options:
|
|
280
|
+
|
|
281
|
+
| Prop | Type | Description |
|
|
282
|
+
| ----------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
283
|
+
| domain | string | The domain of the identity. An email address can also be provided in which case the domain will be extracted from the email. |
|
|
284
|
+
| mailFromSubdomain | string | (optional) by default the custom mail from domain will be `mail.${domain}`. This lets you change that. It should be given as just the subdomain part, not the fully qualified domain. |
|
|
285
|
+
|
|
286
|
+
</details>
|
|
287
|
+
|
|
288
|
+
<details>
|
|
289
|
+
<summary><strong>IxWebsiteRedirect</strong> - Creates a redirect from one domain to another.</summary>
|
|
290
|
+
|
|
291
|
+
```typescript
|
|
292
|
+
import { IxWebsiteRedirect } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
293
|
+
|
|
294
|
+
new IxWebsiteRedirect(scope, "WebsiteRedirect", {
|
|
295
|
+
recordNames: ["www.example.com", "othersubdomain.example.com"],
|
|
296
|
+
targetDomain: "www.example.com",
|
|
297
|
+
});
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
#### Options:
|
|
301
|
+
|
|
302
|
+
| Prop | Type | Description |
|
|
303
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
304
|
+
| targetDomain | string | The domain to redirect to |
|
|
305
|
+
| recordNames | string[] | The domains to redirect from |
|
|
306
|
+
| certificate | [ICertificate](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_certificatemanager.ICertificate.html) | (optional) The certificate to use when serving the redirect, one will be created if not given |
|
|
307
|
+
|
|
308
|
+
</details>
|
|
309
|
+
|
|
310
|
+
<details>
|
|
311
|
+
<summary><strong>IxVpcDetails</strong> - Fetches the standard VPC and subnets that exist in all IX workload aws accounts.</summary>
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
import { IxVpcDetails } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
315
|
+
|
|
316
|
+
const vpcDetails = new IxVpcDetails(scope, "VpcDetails");
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### Options:
|
|
320
|
+
|
|
321
|
+
| Prop | Type | Description |
|
|
322
|
+
| ----------------------- | -------- | --------------------------------------------------------------- |
|
|
323
|
+
| domainName | string | Domain name for cert |
|
|
324
|
+
| subjectAlternativeNames | string[] | (optional) Any domains for the certs "Subject Alternative Name" |
|
|
325
|
+
| region | string | (optional) The AWS region to create the cert in |
|
|
326
|
+
|
|
327
|
+
</details>
|
|
328
|
+
|
|
329
|
+
## Example App Using Make It So
|
|
330
|
+
|
|
331
|
+
To deploy a Next.js based site you would include a `sst.config.ts` file at the root of repo with contents like this:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { SSTConfig } from "sst";
|
|
335
|
+
import { IxNextjsSite } from "@infoxchange/make-it-so-sst-v2/cdk-constructs";
|
|
336
|
+
import deployConfig from "@infoxchange/make-it-so-sst-v2/deployConfig";
|
|
337
|
+
|
|
338
|
+
export default {
|
|
339
|
+
config: () => ({
|
|
340
|
+
name: deployConfig.appName || "fallback-app-name",
|
|
341
|
+
region: deployConfig.primaryAwsRegion,
|
|
342
|
+
}),
|
|
343
|
+
stacks(app) {
|
|
344
|
+
app.stack(
|
|
345
|
+
({ stack }) => {
|
|
346
|
+
const site = new IxNextjsSite(stack, "site", {
|
|
347
|
+
environment: {
|
|
348
|
+
DATABASE_URL: process.env.DATABASE_URL || "",
|
|
349
|
+
SESSION_SECRET: process.env.SESSION_SECRET || "",
|
|
350
|
+
},
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
stack.addOutputs({
|
|
354
|
+
SiteUrl: site.primaryOrigin,
|
|
355
|
+
});
|
|
356
|
+
},
|
|
357
|
+
{ stackName: `${app.name}-${app.stage}` }, // Use the same stack name format as our docker apps
|
|
358
|
+
);
|
|
359
|
+
},
|
|
360
|
+
} satisfies SSTConfig;
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Then simply configure the IX pipeline to deploy that repo as a serverless app. Note it is important that any AWS CDK libraries included in package.json match version match the version used by SST.
|
|
364
|
+
|
|
365
|
+
# The Name
|
|
366
|
+
|
|
367
|
+
Honestly I've never seen Star Trek but I figured the name is appropriate since the goal of this library is to allow you, the user, to deploy applications by stating what you want and letting someone else handle the nitty gritty details of how to actually implement it.
|
|
368
|
+
|
|
369
|
+
# Development and Contributing
|
|
370
|
+
|
|
371
|
+
Changes to the main branch automatically trigger the CI to build and publish to npm. We do this with [semantic-release](https://semantic-release.gitbook.io/) which uses commit messages to determine what the new version number should be.
|
|
372
|
+
|
|
373
|
+
Commit messages must be formatted in the [Conventional Commits](https://www.conventionalcommits.org) style to allow semantic-release to generate release notes based on the git history. To help with this the CLI tool for creating a commit with a valid commit message can be used via `npm run commit`.
|
|
374
|
+
|
|
375
|
+
If adding a new construct the easiest way to develop it maybe by building it in whatever app repo it is intended to be used in. When it appears to be working correctly it can be moved into make-it-so and the app can be updated to import that construct from make-it-so.
|
|
376
|
+
|
|
377
|
+
To test change a change in make-it-so create a branch starting with the prefix "internal-testing-". When pushed the CI will release a new package with a pre-release version. It'll look a little something like `2.1.3-internal-testing-name-of-feature.3`. A serverless app using make-it-so can be modified to use this package version and then deployed to a dev environment to test that the make-it-so changes are functioning correctly. Once a change has been merged into main and there are no serverless apps using the pre-release package any more it's a good idea to [delete that version](https://docs.npmjs.com/unpublishing-packages-from-the-registry#unpublishing-a-single-version-of-a-package) to keep the [npm package version history clean](https://www.npmjs.com/package/@infoxchange/make-it-so-sst-v2?activeTab=versions).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UserConfig } from "@commitlint/types";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
ignores: [
|
|
5
|
+
(message) =>
|
|
6
|
+
// Allow "wip" commits except when publishing a production release or on PR CI jobs
|
|
7
|
+
process.env.GITHUB_EVENT_NAME !== "pull_request" &&
|
|
8
|
+
(process.env.GITHUB_WORKFLOW !== "Publish" ||
|
|
9
|
+
(process.env.GITHUB_REF_NAME?.startsWith("internal-testing-") ??
|
|
10
|
+
true)) &&
|
|
11
|
+
(message === "wip" || message.startsWith("wip:")),
|
|
12
|
+
],
|
|
13
|
+
extends: ["@commitlint/config-conventional"],
|
|
14
|
+
} satisfies UserConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Api } from "sst/constructs";
|
|
2
|
+
type ConstructScope = ConstructorParameters<typeof Api>[0];
|
|
3
|
+
type ConstructId = ConstructorParameters<typeof Api>[1];
|
|
4
|
+
type ConstructProps = Exclude<ConstructorParameters<typeof Api>[2], undefined>;
|
|
5
|
+
export declare class IxApi extends Api {
|
|
6
|
+
constructor(scope: ConstructScope, id: ConstructId, props?: ConstructProps);
|
|
7
|
+
private static setupCustomDomain;
|
|
8
|
+
private static setupCertificate;
|
|
9
|
+
private createDnsRecords;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=IxApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxApi.d.ts","sourceRoot":"","sources":["../../src/cdk-constructs/IxApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAMrC,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,KAAK,cAAc,GAAG,OAAO,CAAC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AAE/E,qBAAa,KAAM,SAAQ,GAAG;gBAE1B,KAAK,EAAE,cAAc,EACrB,EAAE,EAAE,WAAW,EACf,KAAK,GAAE,cAAmB;IAc5B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAgBhC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAuB/B,OAAO,CAAC,gBAAgB;CAazB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Api } from "sst/constructs";
|
|
2
|
+
import { IxCertificate } from "./IxCertificate.js";
|
|
3
|
+
import { IxDnsRecord } from "./IxDnsRecord.js";
|
|
4
|
+
import ixDeployConfig from "../deployConfig.js";
|
|
5
|
+
import { convertToBase62Hash } from "../lib/utils/hash.js";
|
|
6
|
+
export class IxApi extends Api {
|
|
7
|
+
constructor(scope, id, props = {}) {
|
|
8
|
+
if (ixDeployConfig.isIxDeploy) {
|
|
9
|
+
IxApi.setupCustomDomain(scope, id, props);
|
|
10
|
+
}
|
|
11
|
+
super(scope, id, props);
|
|
12
|
+
if (ixDeployConfig.isIxDeploy) {
|
|
13
|
+
this.createDnsRecords(scope);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// This must be static because we need to call it in the constructor before super
|
|
17
|
+
static setupCustomDomain(scope, id, props) {
|
|
18
|
+
// Default to using domains names passed in by the pipeline as the custom domain
|
|
19
|
+
if (ixDeployConfig.isIxDeploy && !("customDomain" in props)) {
|
|
20
|
+
props.customDomain = {
|
|
21
|
+
domainName: ixDeployConfig.siteDomains[0],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
this.setupCertificate(scope, id, props);
|
|
25
|
+
}
|
|
26
|
+
// This must be static because we need to call it in the constructor before super
|
|
27
|
+
static setupCertificate(scope, id, props) {
|
|
28
|
+
if (!props?.customDomain)
|
|
29
|
+
return;
|
|
30
|
+
if (typeof props.customDomain === "string") {
|
|
31
|
+
props.customDomain = { domainName: props.customDomain };
|
|
32
|
+
}
|
|
33
|
+
const domainName = props.customDomain.domainName;
|
|
34
|
+
if (domainName) {
|
|
35
|
+
const domainCert = new IxCertificate(scope, id + "-IxCertificate", {
|
|
36
|
+
domainName,
|
|
37
|
+
region: "ap-southeast-2", // API Gateway wants southeast-2.
|
|
38
|
+
});
|
|
39
|
+
props.customDomain.isExternalDomain = true;
|
|
40
|
+
props.customDomain.cdk = props.customDomain.cdk ?? {};
|
|
41
|
+
props.customDomain.cdk.certificate = domainCert.acmCertificate;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
createDnsRecords(scope) {
|
|
45
|
+
if (this.cdk.domainName?.name && this.cdk.domainName?.regionalDomainName) {
|
|
46
|
+
const domainNameLogicalId = convertToBase62Hash(this.cdk.domainName.name);
|
|
47
|
+
// API Gateway has a separate domain for using with a CNAME (regionalDomainName)
|
|
48
|
+
new IxDnsRecord(scope, `DnsRecord-${domainNameLogicalId}`, {
|
|
49
|
+
type: "CNAME",
|
|
50
|
+
name: this.cdk.domainName.name,
|
|
51
|
+
value: this.cdk.domainName?.regionalDomainName,
|
|
52
|
+
ttl: 900,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Bucket } from "sst/constructs";
|
|
2
|
+
type ConstructScope = ConstructorParameters<typeof Bucket>[0];
|
|
3
|
+
type ConstructId = ConstructorParameters<typeof Bucket>[1];
|
|
4
|
+
type ConstructProps = Exclude<ConstructorParameters<typeof Bucket>[2], undefined>;
|
|
5
|
+
export declare class IxBucket extends Bucket {
|
|
6
|
+
constructor(scope: ConstructScope, id: ConstructId, props?: ConstructProps);
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=IxBucket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxBucket.d.ts","sourceRoot":"","sources":["../../src/cdk-constructs/IxBucket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,KAAK,cAAc,GAAG,OAAO,CAC3B,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,EACvC,SAAS,CACV,CAAC;AAEF,qBAAa,QAAS,SAAQ,MAAM;gBAEhC,KAAK,EAAE,cAAc,EACrB,EAAE,EAAE,WAAW,EACf,KAAK,GAAE,cAAmB;CAmB7B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Bucket } from "sst/constructs";
|
|
2
|
+
import { BucketEncryption } from "aws-cdk-lib/aws-s3";
|
|
3
|
+
import ixDeployConfig from "../deployConfig.js";
|
|
4
|
+
export class IxBucket extends Bucket {
|
|
5
|
+
constructor(scope, id, props = {}) {
|
|
6
|
+
const bucketProps = {
|
|
7
|
+
blockPublicACLs: true,
|
|
8
|
+
...props,
|
|
9
|
+
cdk: {
|
|
10
|
+
...props.cdk,
|
|
11
|
+
bucket: {
|
|
12
|
+
enforceSSL: true,
|
|
13
|
+
...(ixDeployConfig.isIxDeploy
|
|
14
|
+
? { encryption: BucketEncryption.S3_MANAGED }
|
|
15
|
+
: {}),
|
|
16
|
+
...props.cdk?.bucket,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
super(scope, id, bucketProps);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import { ICertificate } from "aws-cdk-lib/aws-certificatemanager";
|
|
3
|
+
type ConstructScope = ConstructorParameters<typeof Construct>[0];
|
|
4
|
+
type ConstructId = ConstructorParameters<typeof Construct>[1];
|
|
5
|
+
type Props = {
|
|
6
|
+
domainName: string;
|
|
7
|
+
subjectAlternativeNames?: string[];
|
|
8
|
+
region?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class IxCertificate extends Construct {
|
|
11
|
+
acmCertificate: ICertificate;
|
|
12
|
+
constructor(scope: ConstructScope, id: ConstructId, props: Props);
|
|
13
|
+
private createCertificate;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=IxCertificate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxCertificate.d.ts","sourceRoot":"","sources":["../../src/cdk-constructs/IxCertificate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAe,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAG/E,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,aAAc,SAAQ,SAAS;IACnC,cAAc,EAAE,YAAY,CAAC;gBAExB,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK;IAKhE,OAAO,CAAC,iBAAiB;CA+B1B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import { StringParameter } from "aws-cdk-lib/aws-ssm";
|
|
3
|
+
import { Certificate } from "aws-cdk-lib/aws-certificatemanager";
|
|
4
|
+
import { CustomResource } from "aws-cdk-lib";
|
|
5
|
+
export class IxCertificate extends Construct {
|
|
6
|
+
acmCertificate;
|
|
7
|
+
constructor(scope, id, props) {
|
|
8
|
+
super(scope, id);
|
|
9
|
+
this.acmCertificate = this.createCertificate(scope, id, props);
|
|
10
|
+
}
|
|
11
|
+
createCertificate(scope, id, props) {
|
|
12
|
+
const certificateCreationLambdaArn = StringParameter.valueForStringParameter(scope, "/shared-services/acm/lambdaArn-v2");
|
|
13
|
+
const certificateCustomResource = new CustomResource(scope, "DomainCert-" + id, {
|
|
14
|
+
resourceType: "Custom::CertIssuingLambda",
|
|
15
|
+
serviceToken: certificateCreationLambdaArn,
|
|
16
|
+
properties: {
|
|
17
|
+
DomainName: props.domainName,
|
|
18
|
+
...(props.subjectAlternativeNames && {
|
|
19
|
+
SubjectAlternativeNames: props.subjectAlternativeNames,
|
|
20
|
+
}),
|
|
21
|
+
...(props.region && { CertificateIssuingRegion: props.region }),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
return Certificate.fromCertificateArn(scope, id + "-AwsCertificate", certificateCustomResource.ref);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
type ConstructScope = ConstructorParameters<typeof Construct>[0];
|
|
3
|
+
type ConstructId = ConstructorParameters<typeof Construct>[1];
|
|
4
|
+
type Props = {
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
ttl?: number;
|
|
8
|
+
hostedZoneId?: string;
|
|
9
|
+
} & ({
|
|
10
|
+
type: "A" | "CNAME" | "NS" | "SOA" | "TXT";
|
|
11
|
+
} | {
|
|
12
|
+
type: "ALIAS";
|
|
13
|
+
aliasZoneId: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "MX";
|
|
16
|
+
priority: number;
|
|
17
|
+
});
|
|
18
|
+
export declare class IxDnsRecord extends Construct {
|
|
19
|
+
constructor(scope: ConstructScope, id: ConstructId, props: Props);
|
|
20
|
+
private createDnsRecord;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=IxDnsRecord.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IxDnsRecord.d.ts","sourceRoot":"","sources":["../../src/cdk-constructs/IxDnsRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,KAAK,WAAW,GAAG,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9D,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,CACA;IACE,IAAI,EAAE,GAAG,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,CAAC;CAC5C,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,GACD;IACE,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB,CACJ,CAAC;AAEF,qBAAa,WAAY,SAAQ,SAAS;gBAC5B,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK;IAKhE,OAAO,CAAC,eAAe;CA6CxB"}
|