Skip to content

Commit 3c287a3

Browse files
authored
Fixed wrong docs
1 parent 2566a48 commit 3c287a3

File tree

1 file changed

+53
-27
lines changed

1 file changed

+53
-27
lines changed

docs/guides/authentication.md

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,28 @@ description: |-
99

1010
The ZenML provider requires authentication to interact with your ZenML server. The provider uses API key authentication to obtain access tokens.
1111

12-
## Configuration
12+
Configure the provider with your ZenML server URL and API key or API token.
1313

14-
The provider can be configured using environment variables:
14+
```hcl
15+
provider "zenml" {
16+
server_url = "https://your-zenml-server.com"
17+
api_key = "your-api-key"
18+
}
19+
```
1520

16-
* `ZENML_SERVER_URL` - (Required) The URL of your ZenML server
17-
* `ZENML_API_KEY` - (Required) Your ZenML API key
21+
For OSS users, the `server_url` is basically the root URL of your ZenML server deployment.
22+
For Pro users, the `server_url` is the the URL of your workspace, which can be found
23+
in your dashboard:
1824

19-
Alternatively, you can provide these credentials directly in the provider configuration:
25+
![ZenML workspace URL](../../assets/workspace_url.png)
26+
27+
It should look like something like `https://1bfe8d94-zenml.cloudinfra.zenml.io`.
28+
29+
You have two options to provide a token or key:
30+
31+
#### Option 1: Using `ZENML_API_KEY`
32+
33+
You can input the `ZENML_API_KEY` as follows:
2034

2135
```hcl
2236
provider "zenml" {
@@ -25,36 +39,48 @@ provider "zenml" {
2539
}
2640
```
2741

28-
!> **Warning:** Hard-coding credentials into your Terraform configuration is not recommended. Use environment variables or other secure methods to provide credentials.
42+
You can also use environment variables:
43+
44+
```bash
45+
export ZENML_SERVER_URL="https://your-zenml-server.com"
46+
export ZENML_API_KEY="your-api-key"
47+
```
48+
49+
To generate a `ZENML_API_KEY`, follow these steps:
2950

30-
## Authentication Process
51+
1. Install ZenML:
52+
```bash
53+
pip install zenml
54+
```
3155

32-
The provider automatically handles the authentication process by:
33-
1. Making a login request to `/api/v1/login` with your API key
34-
2. Obtaining an access token
35-
3. Using this token for subsequent API requests
56+
2. Login to your ZenML server:
57+
```bash
58+
zenml login --url <API_URL>
59+
```
3660

37-
The access token is automatically refreshed for each request to ensure continuous operation.
61+
3. Create a service account and get the API key:
62+
```bash
63+
zenml service-account create <MYSERVICEACCOUNTNAME>
64+
```
3865

39-
## Obtaining Credentials
66+
This command will print out the `ZENML_API_KEY` that you can use with this provider.
4067

41-
1. **Server URL**: This is the URL where your ZenML server is hosted. For example: `https://your-zenml-server.com`
68+
#### Option 2: Using `ZENML_API_TOKEN`
4269

43-
2. **API Key**: You can generate an API key from the ZenML UI or CLI:
44-
```bash
45-
zenml api-key create --name="terraform" --description="For Terraform provider"
46-
```
70+
Alternatively, you can use an API token for authentication:
4771

48-
## Best Practices
72+
```hcl
73+
provider "zenml" {
74+
server_url = "https://your-zenml-server.com"
75+
api_token = "your-api-token"
76+
}
77+
```
4978

50-
* Store credentials using environment variables:
51-
```bash
52-
export ZENML_SERVER_URL="https://your-zenml-server.com"
53-
export ZENML_API_KEY="your-api-key"
54-
```
55-
* Use different API keys for different environments
56-
* Rotate API keys regularly
57-
* Never commit API keys to version control
79+
You can also use environment variables:
80+
```bash
81+
export ZENML_SERVER_URL="https://your-zenml-server.com"
82+
export ZENML_API_TOKEN="your-api-token"
83+
```
5884

5985
## Troubleshooting
6086

0 commit comments

Comments
 (0)