auth0-deploy-cli 8.4.3 → 8.5.0
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/CHANGELOG.md +28 -1
- package/lib/context/defaults.js +7 -0
- package/lib/context/defaults.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -4
- package/lib/index.js.map +1 -1
- package/lib/tools/auth0/handlers/connections.js +1 -1
- package/lib/tools/auth0/handlers/connections.js.map +1 -1
- package/lib/tools/auth0/handlers/databases.d.ts +100 -0
- package/lib/tools/auth0/handlers/databases.js +72 -0
- package/lib/tools/auth0/handlers/databases.js.map +1 -1
- package/lib/tools/auth0/handlers/emailProvider.js +3 -3
- package/lib/tools/auth0/handlers/emailProvider.js.map +1 -1
- package/lib/tools/constants.d.ts +1 -0
- package/lib/tools/constants.js +5 -0
- package/lib/tools/constants.js.map +1 -1
- package/lib/tools/index.d.ts +1 -0
- package/package.json +3 -3
- package/.nyc_output/10fa88b6-c10a-45ce-8cb3-2a8dba4f95d2.json +0 -1
- package/.nyc_output/c42a459f-fc58-412c-a675-01cb9f92dcc9.json +0 -1
- package/.nyc_output/e49c3dcb-08e8-4563-ba45-9b005a768a65.json +0 -1
- package/.nyc_output/processinfo/10fa88b6-c10a-45ce-8cb3-2a8dba4f95d2.json +0 -1
- package/.nyc_output/processinfo/c42a459f-fc58-412c-a675-01cb9f92dcc9.json +0 -1
- package/.nyc_output/processinfo/e49c3dcb-08e8-4563-ba45-9b005a768a65.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -251
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -9786
- package/docs/authenticating-with-tenant.md +0 -34
- package/docs/available-resource-config-formats.md +0 -19
- package/docs/configuring-the-deploy-cli.md +0 -180
- package/docs/excluding-from-management.md +0 -95
- package/docs/how-to-contribute.md +0 -49
- package/docs/keyword-replacement.md +0 -83
- package/docs/multi-environment-workflow.md +0 -98
- package/docs/resource-specific-documentation.md +0 -284
- package/docs/terraform-provider.md +0 -20
- package/docs/using-as-cli.md +0 -89
- package/docs/using-as-node-module.md +0 -114
- package/docs/v8_MIGRATION_GUIDE.md +0 -46
- package/examples/directory/README.md +0 -167
- package/examples/directory/actions/action-example/code.js +0 -4
- package/examples/directory/actions/action-example.json +0 -24
- package/examples/directory/clients/My SPA.json +0 -40
- package/examples/directory/config.json.example +0 -20
- package/examples/directory/connections/facebook.json +0 -60
- package/examples/directory/database-connections/users/change_email.js +0 -4
- package/examples/directory/database-connections/users/change_password.js +0 -4
- package/examples/directory/database-connections/users/create.js +0 -4
- package/examples/directory/database-connections/users/database.json +0 -20
- package/examples/directory/database-connections/users/delete.js +0 -4
- package/examples/directory/database-connections/users/get_user.js +0 -4
- package/examples/directory/database-connections/users/login.js +0 -4
- package/examples/directory/database-connections/users/verify.js +0 -4
- package/examples/directory/emails/blocked_account.html +0 -5
- package/examples/directory/emails/blocked_account.json +0 -10
- package/examples/directory/emails/enrollment_email.html +0 -5
- package/examples/directory/emails/enrollment_email.json +0 -8
- package/examples/directory/emails/mfa_oob_code.html +0 -5
- package/examples/directory/emails/mfa_oob_code.json +0 -8
- package/examples/directory/emails/provider.json +0 -10
- package/examples/directory/emails/reset_email.html +0 -5
- package/examples/directory/emails/reset_email.json +0 -10
- package/examples/directory/emails/stolen_credentials.html +0 -5
- package/examples/directory/emails/stolen_credentials.json +0 -8
- package/examples/directory/emails/verify_email.html +0 -5
- package/examples/directory/emails/verify_email.json +0 -10
- package/examples/directory/emails/verify_email_by_code.html +0 -5
- package/examples/directory/emails/verify_email_by_code.json +0 -8
- package/examples/directory/emails/welcome_email.html +0 -5
- package/examples/directory/emails/welcome_email.json +0 -8
- package/examples/directory/grants/m2m_myapp_api.json +0 -7
- package/examples/directory/guardian/factors/email.json +0 -4
- package/examples/directory/guardian/factors/otp.json +0 -4
- package/examples/directory/guardian/factors/push-notification.json +0 -4
- package/examples/directory/guardian/factors/sms.json +0 -4
- package/examples/directory/guardian/phoneFactorMessageTypes.json +0 -6
- package/examples/directory/guardian/phoneFactorSelectedProvider.json +0 -3
- package/examples/directory/guardian/policies.json +0 -5
- package/examples/directory/guardian/providers/sms-twilio.json +0 -7
- package/examples/directory/guardian/templates/sms.json +0 -5
- package/examples/directory/hooks/client-credentials-exchange.js +0 -22
- package/examples/directory/hooks/client-credentials-exchange.json +0 -12
- package/examples/directory/pages/login.html +0 -6
- package/examples/directory/pages/login.json +0 -4
- package/examples/directory/pages/password_reset.html +0 -6
- package/examples/directory/pages/password_reset.json +0 -4
- package/examples/directory/prompts/custom-text.json +0 -9
- package/examples/directory/prompts/prompts.json +0 -6
- package/examples/directory/prompts/screenRenderSettings/login-id_login-id.json +0 -33
- package/examples/directory/prompts/screenRenderSettings/signup-id_signup-id.json +0 -20
- package/examples/directory/resource-servers/My API.json +0 -19
- package/examples/directory/roles/Admin.json +0 -14
- package/examples/directory/roles/User.json +0 -10
- package/examples/directory/rules/Enrich-Identity-Token.js +0 -10
- package/examples/directory/rules/Enrich-Identity-Token.json +0 -7
- package/examples/directory/rules-configs/SOME_SECRET.json +0 -4
- package/examples/directory/tenant.json +0 -8
- package/examples/directory/triggers/triggers.json +0 -18
- package/examples/yaml/README.md +0 -111
- package/examples/yaml/actions/action-example/code.js +0 -4
- package/examples/yaml/config.json.example +0 -20
- package/examples/yaml/databases/users/change_email.js +0 -4
- package/examples/yaml/databases/users/change_password.js +0 -4
- package/examples/yaml/databases/users/create.js +0 -4
- package/examples/yaml/databases/users/delete.js +0 -4
- package/examples/yaml/databases/users/get_user.js +0 -4
- package/examples/yaml/databases/users/login.js +0 -4
- package/examples/yaml/databases/users/verify.js +0 -4
- package/examples/yaml/emails/change_email.html +0 -5
- package/examples/yaml/hooks/client-credentials-exchange.js +0 -22
- package/examples/yaml/pages/error_page.html +0 -6
- package/examples/yaml/pages/guardian_multifactor.html +0 -6
- package/examples/yaml/pages/login.html +0 -6
- package/examples/yaml/pages/password_reset.html +0 -6
- package/examples/yaml/prompts/screenRenderSettings/login-id_login-id.json +0 -33
- package/examples/yaml/prompts/screenRenderSettings/signup-id_signup-id.json +0 -20
- package/examples/yaml/rules/enrich_tokens.js +0 -10
- package/examples/yaml/tenant.yaml +0 -202
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Authenticating with your Tenant
|
|
2
|
-
|
|
3
|
-
There are three available methods of authenticating the Deploy CLI with your tenant:
|
|
4
|
-
|
|
5
|
-
- [Client Credentials](#client-credentials)
|
|
6
|
-
- [Private Key JWT](#private-key-JWT)
|
|
7
|
-
- [Access Token](#access-token)
|
|
8
|
-
|
|
9
|
-
## Client Credentials
|
|
10
|
-
|
|
11
|
-
Authenticating with a client ID and client secret pair. This option is straightforward and enables the quickest path to setup for the tool. In order to utilize, set both the `AUTH0_CLIENT_ID` and `AUTH0_CLIENT_SECRET` configuration values with the client ID and client secret respectively. These credentials can be found under the "Credentials" tab within the designated application used for the Deploy CLI.
|
|
12
|
-
|
|
13
|
-
## Private Key JWT
|
|
14
|
-
|
|
15
|
-
Providing a private key to facilitate asymmetric key pair authentication. This requires the "Private Key JWT" authentication method for the designated client as well as a public key configured on the remote tenant. This may be appealing to developers who do not wish to have credentials stored remotely on Auth0.
|
|
16
|
-
|
|
17
|
-
To utilize, pass the path of the private key through the `AUTH0_CLIENT_SIGNING_KEY_PATH` configuration property either as an environment variable or property in your `config.json` file. This path is relative to the working directory. Optionally, you can specify the signing algorithm through the `AUTH0_CLIENT_SIGNING_ALGORITHM` configuration property.
|
|
18
|
-
|
|
19
|
-
**Example: **
|
|
20
|
-
|
|
21
|
-
```json
|
|
22
|
-
{
|
|
23
|
-
"AUTH0_CLIENT_SIGNING_KEY_PATH": "./private.pem",
|
|
24
|
-
"AUTH0_CLIENT_SIGNING_ALGORITHM": "RSA256"
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
See [Configure Private Key JWT Authentication](https://auth0.com/docs/get-started/applications/configure-private-key-jwt) for further documentation
|
|
29
|
-
|
|
30
|
-
## Access Token
|
|
31
|
-
|
|
32
|
-
Passing in an access token directly is also supported. This option puts more onus on the developers but can enable flexible and specific workflows when necessary. It can be leveraged by passing the Auth0 access token in via the `AUTH0_ACCESS_TOKEN` environment variable.
|
|
33
|
-
|
|
34
|
-
[[table of contents]](../README.md#documentation)
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Available Resource Config Formats
|
|
2
|
-
|
|
3
|
-
Auth0 resource state is expressed in two available different configuration file formats: YAML and JSON (aka “directory”). When using the Deploy CLI’s export command, you will be prompted with the choice of one versus the other.
|
|
4
|
-
|
|
5
|
-
## YAML
|
|
6
|
-
|
|
7
|
-
The YAML format is expressed mostly as a flat `tenant.yaml` file with supplemental code files for resources like actions and email templates. The single file makes tracking changes over time in version control more straightforward. Additionally, the single file eliminates a bit of ambiguity with directory and file names, which may not be immediately obvious.
|
|
8
|
-
|
|
9
|
-
## Directory (JSON)
|
|
10
|
-
|
|
11
|
-
The directory format separates resource types into separate directories, with each single resource living inside a dedicated JSON file. This format allows for easier conceptual separation between each type of resource as well as the individual resources themselves. Also, the Deploy CLI closely mirrors the data shapes defined in the [Auth0 Management API](https://auth0.com/docs/api/management/v2), so referencing the JSON examples in the docs may provide useful when using this format.
|
|
12
|
-
|
|
13
|
-
## How to Choose
|
|
14
|
-
|
|
15
|
-
The decision to select which format to use should be primarily made off of preference. Both formats are tenable solutions that achieve the same task, but with subtly different strengths and weaknesses described above. Be sure to evaluate each in the context of your context. Importantly, **this choice is not permanent**, and switching from one to the other via the import command is an option at your disposal.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
[[table of contents]](../README.md#documentation)
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
# Configuring the Deploy CLI
|
|
2
|
-
|
|
3
|
-
Configuring the Deploy’s CLI is essential for establishing Auth0 credentials as well as generally modifying the behavior of the tool to your specific needs. There are two ways the Deploy CLI can be configured:
|
|
4
|
-
|
|
5
|
-
- Configuration file (`config.json`)
|
|
6
|
-
- Environment variables
|
|
7
|
-
|
|
8
|
-
## Configuration file
|
|
9
|
-
|
|
10
|
-
A standalone JSON file can be used to configure Deploy CLI. This file will usually reside in the root directory of your project and be called `config.json`.
|
|
11
|
-
|
|
12
|
-
Example **config.json** file:
|
|
13
|
-
|
|
14
|
-
```json
|
|
15
|
-
{
|
|
16
|
-
"AUTH0_DOMAIN": "<YOUR_TENANT_DOMAIN>",
|
|
17
|
-
"AUTH0_CLIENT_ID": "<YOUR_CLIENT_ID>",
|
|
18
|
-
"AUTH0_ALLOW_DELETE": false
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
> ⚠️ **NOTE:** Hard-coding credentials is not recommended, and risks secret leakage should this file ever be committed to a public version control system. Instead, passing credentials as [environment variables](#environment-variables) is considered best practice.
|
|
23
|
-
|
|
24
|
-
### Environment variables
|
|
25
|
-
|
|
26
|
-
By default, the Deploy CLI ingests environment variables, providing the ability to pass credentials and other configurations to the tool without needing to publish to the `config.json` file. Environment variables can either be used to augment the `config.json` file or replace it altogether depending on the project needs.
|
|
27
|
-
|
|
28
|
-
Non-primitive configuration values like `AUTH0_KEYWORD_REPLACE_MAPPINGS` and `AUTH0_EXCLUDED` can also be passed in through environment variables so long as these values are properly serialized JSON.
|
|
29
|
-
|
|
30
|
-
To **disable** the consumption of environment variables for either the `import` or `export` commands, pass the `--env=false` argument.
|
|
31
|
-
|
|
32
|
-
#### Examples
|
|
33
|
-
|
|
34
|
-
```shell
|
|
35
|
-
# Deploying configuration for YAML formats without a config.json file
|
|
36
|
-
export AUTH0_DOMAIN=<YOUR_AUTH0_DOMAIN>
|
|
37
|
-
export AUTH0_CLIENT_ID=<YOUR_CLIENT_ID>
|
|
38
|
-
export AUTH0_CLIENT_SECRET=<YOUR_CLIENT_SECRET>
|
|
39
|
-
|
|
40
|
-
a0deploy import --input_file=local/tenant.yaml
|
|
41
|
-
|
|
42
|
-
# Disable environment variable ingestion
|
|
43
|
-
a0deploy export -c=config.json --format=yaml --output_folder=local --env=false
|
|
44
|
-
|
|
45
|
-
# Non-primitive configuration values
|
|
46
|
-
export AUTH0_EXCLUDED='["actions","organizations"]'
|
|
47
|
-
export AUTH0_KEYWORD_REPLACE_MAPPINGS='{"ENVIRONMENT":"dev"}'
|
|
48
|
-
a0deploy export -c=config.json --format=yaml --output_folder=local
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Free Tier
|
|
52
|
-
|
|
53
|
-
Certain Auth0 resources require a paid plan with a verified credit card on file to manage. On free tier tenants, logStreams need to be excluded in `config.json`. You can also exclude customDomains, if you don't want to add credit card information.
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
"AUTH0_EXCLUDED": ["logStreams", "customDomains"]
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Available Configuration Properties
|
|
60
|
-
|
|
61
|
-
### `AUTH0_DOMAIN`
|
|
62
|
-
|
|
63
|
-
String. The domain of the target Auth0 tenant.
|
|
64
|
-
|
|
65
|
-
### `AUTH0_CLIENT_ID`
|
|
66
|
-
|
|
67
|
-
String. The ID of the designated Auth0 application used to make API requests.
|
|
68
|
-
|
|
69
|
-
### `AUTH0_CLIENT_SECRET`
|
|
70
|
-
|
|
71
|
-
String. The secret of the designated Auth0 application used to make API requests.
|
|
72
|
-
|
|
73
|
-
### `AUTH0_ACCESS_TOKEN`
|
|
74
|
-
|
|
75
|
-
String. Short-lived access token for Management API from designated Auth0 application. Can be used in replacement to client ID and client secret combination.
|
|
76
|
-
|
|
77
|
-
### `AUTH0_CLIENT_SIGNING_KEY_PATH`
|
|
78
|
-
|
|
79
|
-
String. The path to the private key used by the client when facilitating Private Key JWT authentication. Path relative to the working directory. Also note `AUTH0_CLIENT_SIGNING_ALGORITHM` for specifying signing algorithm.
|
|
80
|
-
|
|
81
|
-
### `AUTH0_CLIENT_SIGNING_ALGORITHM`
|
|
82
|
-
|
|
83
|
-
String. Specifies the JWT signing algorithms used by the client when facilitating Private Key JWT authentication. Only used in combination with `AUTH0_CLIENT_SIGNING_KEY_PATH`. Accepted values: `RS256`, `RS384`, `PS256`.
|
|
84
|
-
|
|
85
|
-
### `AUTH0_ALLOW_DELETE`
|
|
86
|
-
|
|
87
|
-
Boolean. When enabled, will allow the tool to delete resources. Default: `false`.
|
|
88
|
-
|
|
89
|
-
### `AUTH0_EXCLUDED`
|
|
90
|
-
|
|
91
|
-
Array of strings. Excludes entire resource types from being managed, bi-directionally. See also: [excluding resources from management](excluding-from-management.md). Possible values: `actions`, `attackProtection`, `branding`, `clientGrants`, `clients`, `connections`, `customDomains`, `databases`, `emailProvider`, `emailTemplates`, `guardianFactorProviders`, `guardianFactorTemplates`, `guardianFactors`, `guardianPhoneFactorMessageTypes`, `guardianPhoneFactorSelectedProvider`, `guardianPolicies`, `logStreams`, `migrations`, `organizations`, `pages`, `prompts`, `resourceServers`, `roles`, `tenant`, `triggers`.
|
|
92
|
-
|
|
93
|
-
Cannot be used simultaneously with `AUTH0_INCLUDED_ONLY`.
|
|
94
|
-
|
|
95
|
-
#### Example
|
|
96
|
-
|
|
97
|
-
```json
|
|
98
|
-
{
|
|
99
|
-
"AUTH0_EXCLUDED": ["organizations", "connections", "hooks"]
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### `AUTH0_INCLUDED_ONLY`
|
|
104
|
-
|
|
105
|
-
Array of strings. Dictates which resource types to _only_ manage, bi-directionally. See also: [excluding resources from management](excluding-from-management.md). Possible values: `actions`, `attackProtection`, `branding`, `clientGrants`, `clients`, `connections`, `customDomains`, `databases`, `emailProvider`, `emailTemplates`, `guardianFactorProviders`, `guardianFactorTemplates`, `guardianFactors`, `guardianPhoneFactorMessageTypes`, `guardianPhoneFactorSelectedProvider`, `guardianPolicies`, `logStreams`, `migrations`, `organizations`, `pages`, `prompts`, `resourceServers`, `roles`, `tenant`, `triggers`
|
|
106
|
-
|
|
107
|
-
#### Example
|
|
108
|
-
|
|
109
|
-
```json
|
|
110
|
-
{
|
|
111
|
-
"AUTH0_INCLUDED_ONLY": ["clients", "connections", "tenant", "branding"]
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Cannot be used simultaneously with `AUTH0_EXCLUDED`.
|
|
116
|
-
|
|
117
|
-
### `AUTH0_KEYWORD_REPLACE_MAPPINGS`
|
|
118
|
-
|
|
119
|
-
Mapping of specific keywords to facilities dynamic replacement. See also: [keyword replacement](keyword-replacement.md).
|
|
120
|
-
|
|
121
|
-
#### Example
|
|
122
|
-
|
|
123
|
-
```json
|
|
124
|
-
{
|
|
125
|
-
"ENVIRONMENT": "DEV",
|
|
126
|
-
"ALLOWED_ORIGINS": ["https://dev.test-site.com", "localhost"]
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### `AUTH0_PRESERVE_KEYWORDS`
|
|
131
|
-
|
|
132
|
-
Boolean. When enabled, will attempt to preserve keyword replacement markers in local resource files during export. Otherwise, the remote values will overwrite those manually-placed keyword markers.
|
|
133
|
-
|
|
134
|
-
This configuration requires the presence of local configuration files and defined keyword replace mappings via the `AUTH0_KEYWORD_REPLACE_MAPPINGS` configuration property.
|
|
135
|
-
|
|
136
|
-
See also: [Preserving Keywords on Export](keyword-replacement.md#preserving-keywords-on-export).
|
|
137
|
-
|
|
138
|
-
### `AUTH0_EXPORT_IDENTIFIERS`
|
|
139
|
-
|
|
140
|
-
Boolean. When enabled, will return identifiers of all resources. May be useful for certain debugging or record-keeping scenarios within a single-tenant context. Default: `false`.
|
|
141
|
-
|
|
142
|
-
### `EXCLUDED_PROPS`
|
|
143
|
-
|
|
144
|
-
Provides ability to exclude any unwanted properties from management.
|
|
145
|
-
|
|
146
|
-
#### Example
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"connections": ["options.twilio_token"]
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### `AUTH0_AUDIENCE`
|
|
155
|
-
|
|
156
|
-
String. Separate value from audience value while retrieving an access token for management API. Useful when default Management API endpoints are not publicly exposed.
|
|
157
|
-
|
|
158
|
-
### `AUTH0_EXCLUDED_RULES`
|
|
159
|
-
|
|
160
|
-
Array of strings. Excludes the management of specific rules by ID. **Note:** This configuration may be subject to deprecation in the future. See: [excluding resources from management](excluding-from-management.md).
|
|
161
|
-
|
|
162
|
-
### `AUTH0_EXCLUDED_CLIENTS`
|
|
163
|
-
|
|
164
|
-
Array of strings. Excludes the management of specific clients by name. **Note:** This configuration may be subject to deprecation in the future. See: [excluding resources from management](excluding-from-management.md).
|
|
165
|
-
|
|
166
|
-
### `AUTH0_EXCLUDED_DATABASES`
|
|
167
|
-
|
|
168
|
-
Array of strings. Excludes the management of specific databases by name. **Note:** This configuration may be subject to deprecation in the future. See: [excluding resources from management](excluding-from-management.md).
|
|
169
|
-
|
|
170
|
-
### `AUTH0_EXCLUDED_CONNECTIONS`
|
|
171
|
-
|
|
172
|
-
Array of strings. Excludes the management of specific connections by name. **Note:** This configuration may be subject to deprecation in the future. See: [excluding resources from management](excluding-from-management.md).
|
|
173
|
-
|
|
174
|
-
### `AUTH0_EXCLUDED_RESOURCE_SERVERS`
|
|
175
|
-
|
|
176
|
-
Array of strings. Excludes the management of specific resource servers by name. **Note:** This configuration may be subject to deprecation in the future. See: [excluding resources from management](excluding-from-management.md).
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
[[table of contents]](../README.md#documentation)
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Excluding Resources From Management
|
|
2
|
-
|
|
3
|
-
In many cases, you may find it useful to exclude resources from being managed. This could be because your tenant has a large number of a particular resource and thus it is operationally burdensome to manage. Other times, you may wish to exclude them as your development workflow only pertains to a specific subset of resources and you’d like to omit all other resources for performance. Regardless of the use case, there are several options available for expressing exclusions in the Deploy CLI.
|
|
4
|
-
|
|
5
|
-
## Excluding entire resources by type
|
|
6
|
-
|
|
7
|
-
For more complex tenants, you may find yourself wanting to omit entire resource types. Some common use cases for wanting this capability:
|
|
8
|
-
|
|
9
|
-
- Enterprise tenant with thousands of organizations, managing all would be operationally burdensome
|
|
10
|
-
- CI/CD process only focuses on managing roles, you may wish to exclude all others
|
|
11
|
-
- Feature development pertains to hook, you may wish to temporarily exclude all others to optimize performance
|
|
12
|
-
|
|
13
|
-
This type of exclusion is expressed by passing an array of resource names into either the `AUTH0_EXCLUDED` or `AUTH0_INCLUDED_ONLY` configuration properties. The `AUTH0_EXCLUDED` configuration property excludes only the resource types provided to it. Inversely, the `AUTH0_INCLUDED_ONLY` property excludes all properties except the ones defined. Exclusion works **bi-directionally**, that is, both when export from Auth0 and importing to Auth0, regardless if resource configuration files exist or not.
|
|
14
|
-
|
|
15
|
-
All supported resource values for exclusion:
|
|
16
|
-
|
|
17
|
-
`actions`, `attackProtection`, `branding`, `clientGrants`, `clients`, `connections`, `customDomains`, `databases`, `emailProvider`, `emailTemplates`, `guardianFactorProviders`, `guardianFactorTemplates`, `guardianFactors`, `guardianPhoneFactorMessageTypes`, `guardianPhoneFactorSelectedProvider`, `guardianPolicies`, `logStreams`, `migrations`, `organizations`, `pages`, `prompts`, `resourceServers`, `roles`, `tenant`, `triggers`
|
|
18
|
-
|
|
19
|
-
### Exclusion Example
|
|
20
|
-
|
|
21
|
-
The following example excludes `clients`, `connections`, `databases` and `organizations` from being managed by the Deploy CLI. However, this example is arbitrary and your use case may require you to exclude less or more types.
|
|
22
|
-
|
|
23
|
-
```json
|
|
24
|
-
{
|
|
25
|
-
"AUTH0_DOMAIN": "example-site.us.auth0.com",
|
|
26
|
-
"AUTH0_CLIENT_ID": "<YOUR_AUTH0_CLIENT_ID>",
|
|
27
|
-
"AUTH0_EXCLUDED": ["clients", "connections", "databases", "organizations"]
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Inclusion Example
|
|
32
|
-
|
|
33
|
-
The following example dictates to _only_ manage `actions`, `clients` and `connections` by the Deploy CLI.
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
{
|
|
37
|
-
"AUTH0_DOMAIN": "example-site.us.auth0.com",
|
|
38
|
-
"AUTH0_CLIENT_ID": "<YOUR_AUTH0_CLIENT_ID>",
|
|
39
|
-
"AUTH0_INCLUDED_ONLY": ["actions", "clients", "connections"]
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Excluding single resources by ID
|
|
44
|
-
|
|
45
|
-
Some resource types support exclusions of individual resource by name. This is primarily useful if you work in a multi-environment context and wish to omit a production single, specific resource from your lower-level environments. The by-Name method of exclusion is supported for rules, clients, databases, connections and resource servers with the `AUTH0_EXCLUDED_RULES` ,`AUTH0_EXCLUDED_CLIENTS`, `AUTH0_EXCLUDED_DATABASES`, `AUTH0_EXCLUDED_CONNECTIONS`, `AUTH0_EXCLUDED_RESOURCE_SERVERS` configuration values respectively.
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{
|
|
49
|
-
"AUTH0_DOMAIN": "example-site.us.auth0.com",
|
|
50
|
-
"AUTH0_CLIENT_ID": "<YOUR_AUTH0_CLIENT_ID>",
|
|
51
|
-
"AUTH0_EXCLUDED_CLIENTS": ["Your Application Name"],
|
|
52
|
-
"AUTH0_EXCLUDED_CONNECTIONS": ["Your Connection Name"]
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
> ⚠️ **NOTE:** Excluding resources by ID is being considered for deprecation in future major versions. See the [resource exclusion proposal](https://github.com/auth0/auth0-deploy-cli/issues/451) for more details.
|
|
57
|
-
|
|
58
|
-
## Omitted vs excluded vs empty
|
|
59
|
-
|
|
60
|
-
The above sections pertain to exclusion which forcefully ignore configurations bi-directionally. It is worth noting similar but very different concepts: “omissions” and “empty” states.
|
|
61
|
-
|
|
62
|
-
### Omission
|
|
63
|
-
|
|
64
|
-
Resource configuration that is absent, either intentionally or unintentionally, will be skipped during import. That is, if you resource configuration were deleted, those configurations would be skipped during import and will not alter the remote tenant state. There is no concept of omission for exporting; unless specifically excluded, all your tenant configurations will be written to resource configuration files.
|
|
65
|
-
|
|
66
|
-
### Example of omission
|
|
67
|
-
|
|
68
|
-
```yaml
|
|
69
|
-
roles: # roles configuration is not omitted
|
|
70
|
-
- name: Admin
|
|
71
|
-
description: Can read and write things
|
|
72
|
-
permissions: []
|
|
73
|
-
- name: Reader
|
|
74
|
-
description: Can only read things
|
|
75
|
-
permissions: []
|
|
76
|
-
# The omission of all other configurations means they'll be skipped over
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Empty
|
|
80
|
-
|
|
81
|
-
Resource configuration that is explicitly defined as empty. For set-based configurations like hooks, organizations and actions, setting these configurations to an empty set expresses an intentional emptying of those resources. In practice, this would signal a deletion, so long as the [`AUTH0_ALLOW_DELETE` deletion configuration property](configuring-the-deploy-cli.md#AUTH0_ALLOW_DELETE) is enabled.
|
|
82
|
-
|
|
83
|
-
For non-set-based resource configuration like tenant, email provider and branding, the expected behavior when applying an explicitly empty configuration value will depend on the resource. The `tenant`, `branding`, `attackProtection`, and `guardianPhoneFactorSelectedProvider` resources cannot be deleted whereas the `emailProvider` resource can be deleted.
|
|
84
|
-
|
|
85
|
-
#### Example of emptiness
|
|
86
|
-
|
|
87
|
-
```yaml
|
|
88
|
-
connections: [] # Empty connections
|
|
89
|
-
tenant: {} # Effectively a no-op, cannot delete tenant
|
|
90
|
-
emailProvider: {} # Will delete email provider
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
[[table of contents]](../README.md#documentation)
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# How to Contribute
|
|
2
|
-
|
|
3
|
-
While we may not prioritize some issues and feature requests, we are much more inclined to address them if accompanied with a code contribution. Please feel empowered to make a code contribution through a Github pull request. Please read the following for the best contributor experience.
|
|
4
|
-
|
|
5
|
-
## Getting started with development
|
|
6
|
-
|
|
7
|
-
The only requirement for development is having [node](https://nodejs.dev/) installed. Most modern versions will work but LTS is recommended.
|
|
8
|
-
|
|
9
|
-
Once node is installed, fork the Deploy CLI repository. Once code is downloaded to local development machine, run the following commands:
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
npm install # Installs all dependencies
|
|
13
|
-
npm run dev # Runs compiler, continuously observes source file changes
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Running tests
|
|
17
|
-
|
|
18
|
-
In order to run the entire test suite, execute `npm run test`.
|
|
19
|
-
|
|
20
|
-
To run a single test file or single test execute:
|
|
21
|
-
|
|
22
|
-
```shell
|
|
23
|
-
npx ts-mocha --timeout=7500 -p tsconfig.json <PATH_TO_TEST_FILE> -g=<OPTIONAL_NAME_OF_TEST>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Examples
|
|
27
|
-
|
|
28
|
-
```shell
|
|
29
|
-
# Runs all tests within a file
|
|
30
|
-
npx ts-mocha --timeout=7500 -p tsconfig.json test/tools/auth0/handlers/actions.tests.js
|
|
31
|
-
|
|
32
|
-
# Runs a single test within a file
|
|
33
|
-
npx ts-mocha --timeout=7500 -p tsconfig.json \
|
|
34
|
-
test/tools/auth0/handlers/actions.tests.js \
|
|
35
|
-
-g="should create action"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Code Contribution Checklist
|
|
39
|
-
|
|
40
|
-
Before finally submitting a PR, please ensure to complete the following:
|
|
41
|
-
|
|
42
|
-
- [ ] All code written in Typescript and compiles
|
|
43
|
-
- [ ] Accompanying tests for functional changes
|
|
44
|
-
- [ ] Any necessary documentation changes to pages in the /docs directory
|
|
45
|
-
- [ ] PR includes thorough description about what code does and why it was added
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
[[table of contents]](../README.md#documentation)
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# Keyword Replacement
|
|
2
|
-
|
|
3
|
-
The Deploy CLI supports dynamic keyword replacement with environment-specific values. This enables a scalable multi-tenant workflow where all tenants share the same resource configuration files but inject subtly different values.
|
|
4
|
-
|
|
5
|
-
To use the keyword replacement, the `AUTH0_KEYWORD_REPLACEMENT_MAPPINGS` configuration property needs to contain the appropriate mappings. Then, in the resource configuration files, keywords can be injected through one of two ways:
|
|
6
|
-
|
|
7
|
-
- `@@EXAMPLE_KEY@@`: Using the `@` symbols causes the tool to perform a `JSON.stringify` on your value before replacing it. So if your value is a string, the tool will add quotes; if your value is an array or object, the tool will add braces.
|
|
8
|
-
- `##EXAMPLE_KEY##`: Using the `#` symbol causes the tool to perform a literal replacement; it will not add quotes or braces.
|
|
9
|
-
|
|
10
|
-
### Example `config.json`
|
|
11
|
-
|
|
12
|
-
```json
|
|
13
|
-
{
|
|
14
|
-
"AUTH0_DOMAIN": "test-tenant.us.auth0.com",
|
|
15
|
-
"AUTH0_CLIENT_ID": "FOO",
|
|
16
|
-
"AUTH0_CLIENT_SECRET": "BAR",
|
|
17
|
-
"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
|
|
18
|
-
"ENVIRONMENT": "dev",
|
|
19
|
-
"ALLOWED_LOGOUT_URLS": ["https://dev-test-site.com/logout", "localhost:3000/logout"],
|
|
20
|
-
"ALLOWED_ORIGINS": ["https://dev-test-site.com", "localhost:3000"]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Example `tenant.yaml`
|
|
26
|
-
|
|
27
|
-
```yaml
|
|
28
|
-
tenant:
|
|
29
|
-
friendly_name: "##ENVIRONMENT## tenant"
|
|
30
|
-
allowed_logout_urls: @@ALLOWED_LOGOUT_URLS@@
|
|
31
|
-
enabled_locales:
|
|
32
|
-
- en
|
|
33
|
-
clients:
|
|
34
|
-
- name: Test App
|
|
35
|
-
allowed_origins: @@ALLOWED_ORIGINS@@
|
|
36
|
-
allowed_logout_urls: @@ALLOWED_LOGOUT_URLS@@
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Example `tenant.json`
|
|
40
|
-
|
|
41
|
-
```json
|
|
42
|
-
{
|
|
43
|
-
"friendly_name": "##ENVIRONMENT## tenant",
|
|
44
|
-
"allowed_logout_urls": "@@ALLOWED_LOGOUT_URLS@@"
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Array Concatenation
|
|
49
|
-
|
|
50
|
-
You may encounter situations where you would want to concatenate values onto a static array through keyword replacement. There is no special syntax to support this case, however, it is possible to achieve this by escaping double quotes in a single string that contains the appropriate values and injecting with the `##` keyword syntax. This technique works for both the [YAML and directory formats](./available-resource-config-formats.md).
|
|
51
|
-
|
|
52
|
-
### Example `config.json`
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
{
|
|
56
|
-
"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
|
|
57
|
-
"GLOBAL_WEB_ORIGINS": "\"http://local.me:8080\", \"http://localhost\", \"http://localhost:3000\""
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Example `tenant.yaml`
|
|
63
|
-
|
|
64
|
-
```yaml
|
|
65
|
-
clients:
|
|
66
|
-
- name: Test App
|
|
67
|
-
web_origins: [ "http://production-app.com", "https://production-app.com", ##GLOBAL_WEB_ORIGINS## ]
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Preserving Keywords on Export
|
|
71
|
-
|
|
72
|
-
Generally, the Deploy CLI works best when operating in a uni-directional workflow from your lower-level environments (ex: dev, test) up to your production environments. However, there will be times when it is necessary to export configuration from a higher-level environment onto your local configuration directory. By default, the remote values will overwrite your local values, **causing the deletion of your keyword markers**. However, keyword replacement preservation can be enabled through the `AUTH0_PRESERVE_KEYWORDS` boolean configuration property. By enabling this configuration, the Deploy CLI will attempt to preserve the keyword markers defined in your local configuration files during export.
|
|
73
|
-
|
|
74
|
-
The keyword preservation functionality will attempt to preserve as many keywords while also maintaining the accuracy of your resource configuration files. And it the majority of cases, it will work without any intervention by the user. However, some key limitations exist:
|
|
75
|
-
|
|
76
|
-
- In the case of a keyword-replaced configuration field with differing values between local and remote, the local configuration value will _always_ be favored. This will cause **any out-of-band changes on remote to be wiped away** if a keyword replace marker exists anywhere in that field's value in the resource definition file; there is no "intelligent" reconciliation.
|
|
77
|
-
- Arrays without a specific identifiers are not eligible for preservation. Ex: `[ "http://site.com/logout", "localhost:3000/logout", "##LOGOUT_URL##" ]`. This is because the ordering of these values are non-deterministic. Alternatively, to preserve these values, it is recommended to leverage the `@@ARRAY_REPLACE@@` keyword replace syntax with the entire value.
|
|
78
|
-
|
|
79
|
-
To learn more about the history and technical challenges of of keyword preservation, refer to [RFC: Keyword Preservation During Export](https://github.com/auth0/auth0-deploy-cli/issues/688).
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
[[table of contents]](../README.md#documentation)
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# Incorporating Into Multi-environment Workflows
|
|
2
|
-
|
|
3
|
-
The Deploy CLI supports working within a multi-tenant, multi-environment context. When integrated into your CI/CD development workflows, can be used to propagate Auth0 changes from feature development all the way through production.
|
|
4
|
-
|
|
5
|
-
In general, the advised workflow is as follows:
|
|
6
|
-
|
|
7
|
-
- Create a separate Auth0 tenant for each environment (ex: dev, staging, prod)
|
|
8
|
-
- Create a single repository of resource configuration files for all environments
|
|
9
|
-
- Add a step in your CI/CD pipeline when deploying to environments that applies the Auth0 resource configurations to the appropriate Auth0 tenant
|
|
10
|
-
|
|
11
|
-
## Tenant to Environment
|
|
12
|
-
|
|
13
|
-
It is recommended to have a separate Auth0 tenant/account for each environment you have. For example:
|
|
14
|
-
|
|
15
|
-
| Environment | Tenant |
|
|
16
|
-
| ----------- | ------------- |
|
|
17
|
-
| Development | travel0-dev |
|
|
18
|
-
| Testing | travel0-uat |
|
|
19
|
-
| Staging | travel0-stage |
|
|
20
|
-
| Production | travel0-prod |
|
|
21
|
-
|
|
22
|
-
## Resource configuration repository
|
|
23
|
-
|
|
24
|
-
When exported, your Auth0 tenant state will be represented as a set of resource configuration files, either in a [YAML or JSON format](./available-resource-config-formats.md). In a multi-environment context it is expected to have a single repository of resource configurations that is applied to all environments. In practice, this may exist as a directory in your project’s codebase or in a separate codebase altogether.
|
|
25
|
-
|
|
26
|
-
You should have at least one branch for each tenant in your repository, which allows you to make changes without deploying them (the changes would only deploy when you merged your branch into the master, or primary, branch). With this setup, you can have a continuous integration task for each environment that automatically deploys changes to the targeted environment whenever the master branch receives updates.
|
|
27
|
-
|
|
28
|
-
Your workflow could potentially look something like this:
|
|
29
|
-
|
|
30
|
-
1. Make changes to development.
|
|
31
|
-
2. Merge changes to testing (or `uat`).
|
|
32
|
-
3. Test changes to `uat`. When ready, move and merge the changes to `staging`.
|
|
33
|
-
4. Test `staging`. When ready, move and merge the changes to `production`.
|
|
34
|
-
|
|
35
|
-
You may want to set your production environment to deploy only when triggered manually.
|
|
36
|
-
|
|
37
|
-
## Uni-directional Flow
|
|
38
|
-
|
|
39
|
-
The multi-environment workflow works best when changes are propagated “up” in a single direction. Changes to the resource configuration files should first be applied to the lowest level environment (ex: dev) and then incrementally applied up through all other environments until applied to production. This uni-directional practice ensures sufficient testing and approval for changes to your tenant. Once set, it is recommended to not apply configurations directly to production through other means such as the Auth0 Dashboard or Management API unless those changes are captured by a subsequent Deploy CLI export. Otherwise, those changes are subject to overwrite.
|
|
40
|
-
|
|
41
|
-
## Environment-specific values
|
|
42
|
-
|
|
43
|
-
While it is expected that all environments will share the same set of resource configuration files, environment-specific values can be expressed through separate tool configuration files and dynamic [keyword replacement](keyword-replacement.md).
|
|
44
|
-
|
|
45
|
-
### Separate Config Files
|
|
46
|
-
|
|
47
|
-
Specifying a separate tool configuration file per environment can be used to keep the resource configuration files agnostic of environment but still cater for the needs of each environment. At a minimum, you will need to provide separate credentials for each environment, but it is also possible to exclude certain resources, enable deletion and perform dynamic keyword replacement on a per-environment basis.
|
|
48
|
-
|
|
49
|
-
### Example file structure
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
project-root
|
|
53
|
-
│
|
|
54
|
-
└───auth0
|
|
55
|
-
│ │ config-dev.json # Dev env config file
|
|
56
|
-
│ │ config-test.json # Test env config file
|
|
57
|
-
│ │ config-prod.json # Prod env config file
|
|
58
|
-
│ │ ... all other resource configuration files
|
|
59
|
-
│
|
|
60
|
-
└───src
|
|
61
|
-
│ ... your project code
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Dynamic Values via Keyword Replacement
|
|
65
|
-
|
|
66
|
-
Once separate configurations files are adopted for each environment, keyword replacement via the `AUTH0_KEYWORD_REPLACE_MAPPINGS` configuration property can be used to express the dynamic replacement values depending on the environment. For example, you may find it necessary to have a separate set of allowed origins for your clients (see below). To learn more, see [Keyword Replacement](keyword-replacement.md).
|
|
67
|
-
|
|
68
|
-
#### Example `config-dev.json`
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"AUTH0_DOMAIN": "travel0-dev.us.auth0.com",
|
|
73
|
-
"AUTH0_CLIENT_ID": "PdwQpGy62sHcsV6ufZNEVrV4GDlDhm74",
|
|
74
|
-
"AUTH0_ALLOW_DELETE": true,
|
|
75
|
-
"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
|
|
76
|
-
"ENV": "dev",
|
|
77
|
-
"ALLOWED_ORIGINS": ["http://localhost:3000", "http://dev.travel0.com"]
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
#### Example `config-prod.json`
|
|
83
|
-
|
|
84
|
-
```json
|
|
85
|
-
{
|
|
86
|
-
"AUTH0_DOMAIN": "travel0.us.auth0.com",
|
|
87
|
-
"AUTH0_CLIENT_ID": "vZCEFsDYzXc1x9IomB8dF185e4cdVah5",
|
|
88
|
-
"AUTH0_ALLOW_DELETE": false,
|
|
89
|
-
"AUTH0_KEYWORD_REPLACE_MAPPINGS": {
|
|
90
|
-
"ENV": "prod",
|
|
91
|
-
"ALLOWED_ORIGINS": ["http://travel0.com"]
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
[[table of contents]](../README.md#documentation)
|