Skip to content

Commit

Permalink
Update docs with usage examples (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdelucaa authored May 16, 2022
1 parent ce700f8 commit a2e500d
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 52 deletions.
32 changes: 18 additions & 14 deletions docs/data-sources/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,39 @@ description: |-

Retrieve details of an existing feature

## Example Usage

```terraform
data "unleash_feature" "example" {
name = "toggle"
project_id = "default"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **name** (String) Feature name
- **project_id** (String) The project id of the feature toggle

### Optional

- **id** (String) The ID of this resource.
- `name` (String) Feature name
- `project_id` (String) The project id of the feature toggle

### Read-Only

- **archived** (Boolean) Wether the feature toggle is archived or not
- **created_at** (String) The date the feature toggle was created
- **description** (String) The description of the feature toggle
- **environments** (List of Object) The environments of the feature toggle (see [below for nested schema](#nestedatt--environments))
- **stale** (Boolean) Wether the feature toggle is stale or not
- **type** (String) The type of the feature toggle
- `archived` (Boolean) Wether the feature toggle is archived or not
- `created_at` (String) The date the feature toggle was created
- `description` (String) The description of the feature toggle
- `environments` (List of Object) The environments of the feature toggle (see [below for nested schema](#nestedatt--environments))
- `id` (String) The ID of this resource.
- `stale` (Boolean) Wether the feature toggle is stale or not
- `type` (String) The type of the feature toggle

<a id="nestedatt--environments"></a>
### Nested Schema for `environments`

Read-Only:

- **enabled** (Boolean)
- **name** (String)
- `enabled` (Boolean)
- `name` (String)


19 changes: 11 additions & 8 deletions docs/data-sources/feature_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@ description: |-

Retrieve details of an existing feature type

## Example Usage

```terraform
data "unleash_feature_type" "example" {
type_id = "kill-switch"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **type_id** (String) The id of the feature type

### Optional

- **id** (String) The ID of this resource.
- `type_id` (String) The id of the feature type

### Read-Only

- **description** (String) The description of the feature type
- **lifetime_days** (Number) The lifetime of the feature type in days
- **name** (String) Feature type name
- `description` (String) The description of the feature type
- `id` (String) The ID of this resource.
- `lifetime_days` (Number) The lifetime of the feature type in days
- `name` (String) Feature type name


21 changes: 12 additions & 9 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ description: |-

Retrieve details of an existing unleash project

## Example Usage

```terraform
data "unleash_project" "example" {
project_id = "default"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **project_id** (String) The project id of the unleash project

### Optional

- **id** (String) The ID of this resource.
- `project_id` (String) The project id of the unleash project

### Read-Only

- **description** (String) The description of the unleash project
- **environments** (Set of String) The list of unleash environments in this project
- **name** (String) Project name
- **updated_at** (String) The date the unleash project was last updated
- `description` (String) The description of the unleash project
- `environments` (Set of String) The list of unleash environments in this project
- `id` (String) The ID of this resource.
- `name` (String) Project name
- `updated_at` (String) The date the unleash project was last updated


4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ provider "unleash" {

### Required

- **api_url** (String) URL of the unleash API
- **auth_token** (String, Sensitive) Authentication token to authenticate to the Unleash API
- `api_url` (String) URL of the unleash API
- `auth_token` (String, Sensitive) Authentication token to authenticate to the Unleash API
29 changes: 24 additions & 5 deletions docs/resources/feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,39 @@ description: |-

Provides a resource for managing unleash features.

## Example Usage

```terraform
data "unleash_project" "example" {
project_id = "default"
}
data "unleash_feature_type" "example" {
type_id = "kill-switch"
}
resource "unleash_feature" "example" {
name = "toggle"
project_id = data.unleash_project.example.project_id
type = data.unleash_feature_type.example.type_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **name** (String) Feature name
- **project_id** (String) The feature will be created in the given project
- **type** (String) Feature type
- `name` (String) Feature name
- `project_id` (String) The feature will be created in the given project
- `type` (String) Feature type

### Optional

- **description** (String) Feature description
- **id** (String) The ID of this resource.
- `description` (String) Feature description

### Read-Only

- `id` (String) The ID of this resource.


51 changes: 46 additions & 5 deletions docs/resources/feature_enabling.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,61 @@ description: |-

Provides a resource for enabling a feature toggle in the given environment. This can be only done after the feature toggle has at least one strategy.

## Example Usage

```terraform
data "unleash_project" "example" {
project_id = "default"
}
data "unleash_feature_type" "example" {
type_id = "kill-switch"
}
resource "unleash_feature" "example" {
name = "toggle"
project_id = data.unleash_project.example.project_id
type = data.unleash_feature_type.example.type_id
}
resource "unleash_strategy_assignment" "example" {
feature_name = unleash_feature.example.name
project_id = data.unleash_project.example.project_id
environment = "development"
strategy_name = "flexibleRollout"
parameters = {
rollout = "68"
stickiness = "random"
groupId = "toggle"
}
}
resource "unleash_feature_enabling" "example" {
feature_name = unleash_feature.example.name
project_id = data.unleash_project.example.project_id
environment = "development"
enabled = true
depends_on = [
unleash_strategy_assignment.example // you can not enable the environment before it has strategies
]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **environment** (String) The environment where the toggle will be enabled
- **feature_name** (String) Feature name to enabled
- **project_id** (String) The unleash project the feature is in
- `environment` (String) The environment where the toggle will be enabled
- `feature_name` (String) Feature name to enabled
- `project_id` (String) The unleash project the feature is in

### Optional

- **enabled** (Boolean) Whether the feature is on/off in the provided environment
- **id** (String) The ID of this resource.
- `enabled` (Boolean) Whether the feature is on/off in the provided environment

### Read-Only

- `id` (String) The ID of this resource.


44 changes: 36 additions & 8 deletions docs/resources/strategy_assignment.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,53 @@ description: |-

Provides a resource for add strategy to a feature toggle in the given environment.


## Example Usage

```terraform
data "unleash_project" "example" {
project_id = "default"
}
data "unleash_feature_type" "example" {
type_id = "kill-switch"
}
resource "unleash_feature" "example" {
name = "toggle"
project_id = data.unleash_project.example.project_id
type = data.unleash_feature_type.example.type_id
}
resource "unleash_strategy_assignment" "example" {
feature_name = unleash_feature.example.name
project_id = data.unleash_project.example.project_id
environment = "development"
strategy_name = "flexibleRollout"
parameters = {
rollout = "68"
stickiness = "random"
groupId = "toggle"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- **environment** (String) The environment where the strategy will take place
- **feature_name** (String) Feature name to assign the strategy to
- **project_id** (String) The unleash project the feature is in
- **strategy_name** (String) Strategy unique name
- `environment` (String) The environment where the strategy will take place
- `feature_name` (String) Feature name to assign the strategy to
- `project_id` (String) The unleash project the feature is in
- `strategy_name` (String) Strategy unique name

### Optional

- **id** (String) The ID of this resource.
- **parameters** (Map of String) Strategy parameters. All the values need to informed as strings.
- `parameters` (Map of String) Strategy parameters. All the values need to informed as strings.

### Read-Only

- **strategy_id** (String) Strategy id
- `id` (String) The ID of this resource.
- `strategy_id` (String) Strategy id


Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ resource "unleash_strategy_assignment" "example" {
stickiness = "random"
groupId = "toggle"
}
}
}

0 comments on commit a2e500d

Please sign in to comment.