generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Feature flag and FF SDK Key resources (#517)
* Add support for Feature flag and FF SDK Key resources * Add changelog and render docs
- Loading branch information
Showing
8 changed files
with
791 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
```release-note:new-resource | ||
platform_feature_flag - Added feature flag resources to the Harness Terraform Provider. | ||
platform_ff_api_key - Added FF SDK API key resources to the Harness Terraform provider. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "harness_platform_feature_flag Resource - terraform-provider-harness" | ||
subcategory: "Next Gen" | ||
description: |- | ||
Resource for managing Feature Flags. | ||
--- | ||
|
||
# harness_platform_feature_flag (Resource) | ||
|
||
Resource for managing Feature Flags. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
// Boolean Flag | ||
resource "harness_platform_feature_flag" "mybooleanflag" { | ||
org_id = "test" | ||
project_id = "testff" | ||
kind = "boolean" | ||
name = "MY_FEATURE" | ||
identifier = "MY_FEATURE" | ||
permanent = false | ||
default_on_variation = "Enabled" | ||
default_off_variation = "Disabled" | ||
variation { | ||
identifier = "Enabled" | ||
name = "Enabled" | ||
description = "The feature is enabled" | ||
value = "true" | ||
} | ||
variation { | ||
identifier = "Disabled" | ||
name = "Disabled" | ||
description = "The feature is disabled" | ||
value = "false" | ||
} | ||
} | ||
// Multivariate flag | ||
resource "harness_platform_feature_flag" "mymultivariateflag" { | ||
org_id = "test" | ||
project_id = "testff" | ||
kind = "int" | ||
name = "FREE_TRIAL_DURATION" | ||
identifier = "FREE_TRIAL_DURATION" | ||
permanent = false | ||
default_on_variation = "trial7" | ||
default_off_variation = "trial20" | ||
variation { | ||
identifier = "trial7" | ||
name = "7 days trial" | ||
description = "Free trial period 7 days" | ||
value = "7" | ||
} | ||
variation { | ||
identifier = "trial14" | ||
name = "14 days trial" | ||
description = "Free trial period 14 days" | ||
value = "14" | ||
} | ||
variation { | ||
identifier = "trial20" | ||
name = "20 days trial" | ||
description = "Free trial period 20 days" | ||
value = "20" | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `default_off_variation` (String) Which of the variations to use when the flag is toggled to off state | ||
- `default_on_variation` (String) Which of the variations to use when the flag is toggled to on state | ||
- `identifier` (String) Identifier of the Feature Flag | ||
- `kind` (String) The type of data the flag represents. Valid values are `boolean`, `int`, `string`, `json` | ||
- `name` (String) Name of the Feature Flag | ||
- `org_id` (String) Organization Identifier | ||
- `permanent` (Boolean) Whether or not the flag is permanent. If it is, it will never be flagged as stale | ||
- `project_id` (String) Project Identifier | ||
- `variation` (Block List, Min: 2) The options available for your flag (see [below for nested schema](#nestedblock--variation)) | ||
|
||
### Optional | ||
|
||
- `archived` (Boolean) Whether or not the flag is archived | ||
- `git_details` (Block Set, Max: 1) (see [below for nested schema](#nestedblock--git_details)) | ||
- `owner` (String) The owner of the flag | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
<a id="nestedblock--variation"></a> | ||
### Nested Schema for `variation` | ||
|
||
Required: | ||
|
||
- `description` (String) The description of the variation | ||
- `identifier` (String) The identifier of the variation | ||
- `name` (String) The user friendly name of the variation | ||
- `value` (String) The value of the variation | ||
|
||
|
||
<a id="nestedblock--git_details"></a> | ||
### Nested Schema for `git_details` | ||
|
||
Required: | ||
|
||
- `commit_msg` (String) The commit message to use as part of a gitsync operation | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "harness_platform_ff_api_key Resource - terraform-provider-harness" | ||
subcategory: "Next Gen" | ||
description: |- | ||
Resource for creating an environment SDK key for Feature Flags. | ||
--- | ||
|
||
# harness_platform_ff_api_key (Resource) | ||
|
||
Resource for creating an environment SDK key for Feature Flags. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "harness_platform_ff_api_key" "testserverapikey" { | ||
identifier = "testserver" | ||
name = "TestServer" | ||
description = "this is a server SDK key" | ||
org_id = "test" | ||
project_id = "testff" | ||
env_id = "testenv" | ||
expired_at = 1713729225 | ||
type = "Server" | ||
} | ||
output "serversdkkey" { | ||
value = harness_platform_ff_api_key.testserverapikey.api_key | ||
sensitive = true | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `env_id` (String) Environment Identifier | ||
- `identifier` (String) Identifier of the SDK API Key | ||
- `name` (String) Name of the SDK API Key | ||
- `org_id` (String) Organization Identifier | ||
- `project_id` (String) Project Identifier | ||
- `type` (String) Type of SDK. Valid values are `Server` or `Client`. | ||
|
||
### Optional | ||
|
||
- `description` (String) Description of the SDK API Key | ||
- `expired_at` (Number) Expiration datetime of the SDK API Key | ||
|
||
### Read-Only | ||
|
||
- `api_key` (String, Sensitive) The value of the SDK API Key | ||
- `id` (String) The ID of this resource. | ||
|
||
|
63 changes: 63 additions & 0 deletions
63
examples/resources/harness_platform_feature_flag/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Boolean Flag | ||
resource "harness_platform_feature_flag" "mybooleanflag" { | ||
org_id = "test" | ||
project_id = "testff" | ||
|
||
kind = "boolean" | ||
name = "MY_FEATURE" | ||
identifier = "MY_FEATURE" | ||
permanent = false | ||
|
||
default_on_variation = "Enabled" | ||
default_off_variation = "Disabled" | ||
|
||
variation { | ||
identifier = "Enabled" | ||
name = "Enabled" | ||
description = "The feature is enabled" | ||
value = "true" | ||
} | ||
|
||
variation { | ||
identifier = "Disabled" | ||
name = "Disabled" | ||
description = "The feature is disabled" | ||
value = "false" | ||
} | ||
} | ||
|
||
|
||
// Multivariate flag | ||
resource "harness_platform_feature_flag" "mymultivariateflag" { | ||
org_id = "test" | ||
project_id = "testff" | ||
|
||
kind = "int" | ||
name = "FREE_TRIAL_DURATION" | ||
identifier = "FREE_TRIAL_DURATION" | ||
permanent = false | ||
|
||
default_on_variation = "trial7" | ||
default_off_variation = "trial20" | ||
|
||
variation { | ||
identifier = "trial7" | ||
name = "7 days trial" | ||
description = "Free trial period 7 days" | ||
value = "7" | ||
} | ||
|
||
variation { | ||
identifier = "trial14" | ||
name = "14 days trial" | ||
description = "Free trial period 14 days" | ||
value = "14" | ||
} | ||
|
||
variation { | ||
identifier = "trial20" | ||
name = "20 days trial" | ||
description = "Free trial period 20 days" | ||
value = "20" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
examples/resources/harness_platform_ff_api_key/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
resource "harness_platform_ff_api_key" "testserverapikey" { | ||
identifier = "testserver" | ||
name = "TestServer" | ||
description = "this is a server SDK key" | ||
org_id = "test" | ||
project_id = "testff" | ||
env_id = "testenv" | ||
expired_at = 1713729225 | ||
type = "Server" | ||
} | ||
|
||
output "serversdkkey" { | ||
value = harness_platform_ff_api_key.testserverapikey.api_key | ||
sensitive = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.