Skip to content

Commit

Permalink
Update schema and doc GitCredential, Lifecycles and TenantProjectVar…
Browse files Browse the repository at this point in the history
…iable (#717)

* Update lifecycles schema and doc

* Fix lifecyle schema

* Update git credential resource

* Refactor tenant project variable

* Make it consistent

* Update datasource GitCredentialModel

* fix test fail

* Add username_password_account resource

* Revert "Add username_password_account resource"

This reverts commit 7a20ecb.

* Update doc example

* small change on lifecycle example
  • Loading branch information
HuyPhanNguyen authored Aug 8, 2024
1 parent 3a8a027 commit 7fade05
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 211 deletions.
70 changes: 35 additions & 35 deletions docs/data-sources/lifecycles.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,62 +26,62 @@ data "octopusdeploy_lifecycles" "example" {

### Optional

- `ids` (List of String) A filter to search by a list of IDs.
- `partial_name` (String) A filter to search by the partial match of a name.
- `ids` (List of String) A list of lifecycle IDs to filter by.
- `partial_name` (String) A partial name to filter lifecycles by.
- `skip` (Number) A filter to specify the number of items to skip in the response.
- `space_id` (String) The space ID associated with this resource.
- `space_id` (String) The space ID associated with this lifecycle.
- `take` (Number) A filter to specify the number of items to take (or return) in the response.

### Read-Only

- `id` (String) The ID of this resource.
- `lifecycles` (Block List) A list of lifecycles that match the filter(s). (see [below for nested schema](#nestedblock--lifecycles))
- `id` (String) The ID of the lifecycle.
- `lifecycles` (Attributes List) (see [below for nested schema](#nestedatt--lifecycles))

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

Read-Only:

- `description` (String) The description of this lifecycle.
- `id` (String) The unique ID for this resource.
- `name` (String) The name of this resource.
- `phase` (List of Object) (see [below for nested schema](#nestedatt--lifecycles--phase))
- `release_retention_policy` (List of Object) (see [below for nested schema](#nestedatt--lifecycles--release_retention_policy))
- `space_id` (String) The space ID associated with this resource.
- `tentacle_retention_policy` (List of Object) (see [below for nested schema](#nestedatt--lifecycles--tentacle_retention_policy))
- `description` (String) The description of the lifecycle.
- `id` (String) The ID of the lifecycle.
- `name` (String) The name of the lifecycle.
- `phase` (Attributes List) (see [below for nested schema](#nestedatt--lifecycles--phase))
- `release_retention_policy` (Attributes List) (see [below for nested schema](#nestedatt--lifecycles--release_retention_policy))
- `space_id` (String) The space ID associated with this lifecycle.
- `tentacle_retention_policy` (Attributes List) (see [below for nested schema](#nestedatt--lifecycles--tentacle_retention_policy))

<a id="nestedatt--lifecycles--phase"></a>
### Nested Schema for `lifecycles.phase`

Read-Only:

- `automatic_deployment_targets` (List of String)
- `id` (String)
- `is_optional_phase` (Boolean)
- `minimum_environments_before_promotion` (Number)
- `name` (String)
- `optional_deployment_targets` (List of String)
- `release_retention_policy` (List of Object) (see [below for nested schema](#nestedobjatt--lifecycles--phase--release_retention_policy))
- `tentacle_retention_policy` (List of Object) (see [below for nested schema](#nestedobjatt--lifecycles--phase--tentacle_retention_policy))
- `automatic_deployment_targets` (List of String) The automatic deployment targets for this phase.
- `id` (String) The ID of the phase.
- `is_optional_phase` (Boolean) Whether this phase is optional.
- `minimum_environments_before_promotion` (Number) The minimum number of environments before promotion.
- `name` (String) The name of the phase.
- `optional_deployment_targets` (List of String) The optional deployment targets for this phase.
- `release_retention_policy` (Attributes List) (see [below for nested schema](#nestedatt--lifecycles--phase--release_retention_policy))
- `tentacle_retention_policy` (Attributes List) (see [below for nested schema](#nestedatt--lifecycles--phase--tentacle_retention_policy))

<a id="nestedobjatt--lifecycles--phase--release_retention_policy"></a>
<a id="nestedatt--lifecycles--phase--release_retention_policy"></a>
### Nested Schema for `lifecycles.phase.release_retention_policy`

Read-Only:

- `quantity_to_keep` (Number)
- `should_keep_forever` (Boolean)
- `unit` (String)
- `quantity_to_keep` (Number) The quantity of releases to keep.
- `should_keep_forever` (Boolean) Whether releases should be kept forever.
- `unit` (String) The unit of time for the retention policy.


<a id="nestedobjatt--lifecycles--phase--tentacle_retention_policy"></a>
<a id="nestedatt--lifecycles--phase--tentacle_retention_policy"></a>
### Nested Schema for `lifecycles.phase.tentacle_retention_policy`

Read-Only:

- `quantity_to_keep` (Number)
- `should_keep_forever` (Boolean)
- `unit` (String)
- `quantity_to_keep` (Number) The quantity of releases to keep.
- `should_keep_forever` (Boolean) Whether releases should be kept forever.
- `unit` (String) The unit of time for the retention policy.



Expand All @@ -90,18 +90,18 @@ Read-Only:

Read-Only:

- `quantity_to_keep` (Number)
- `should_keep_forever` (Boolean)
- `unit` (String)
- `quantity_to_keep` (Number) The quantity of releases to keep.
- `should_keep_forever` (Boolean) Whether releases should be kept forever.
- `unit` (String) The unit of time for the retention policy.


<a id="nestedatt--lifecycles--tentacle_retention_policy"></a>
### Nested Schema for `lifecycles.tentacle_retention_policy`

Read-Only:

- `quantity_to_keep` (Number)
- `should_keep_forever` (Boolean)
- `unit` (String)
- `quantity_to_keep` (Number) The quantity of releases to keep.
- `should_keep_forever` (Boolean) Whether releases should be kept forever.
- `unit` (String) The unit of time for the retention policy.


10 changes: 5 additions & 5 deletions docs/resources/git_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "octopusdeploy_git_credential Resource - terraform-provider-octopusdeploy"
subcategory: ""
description: |-
This resource manages Git credentials in Octopus Deploy.
Manages a Git credential in Octopus Deploy.
---

# octopusdeploy_git_credential (Resource)

This resource manages Git credentials in Octopus Deploy.
Manages a Git credential in Octopus Deploy.



Expand All @@ -17,15 +17,15 @@ This resource manages Git credentials in Octopus Deploy.

### Required

- `name` (String) The name of the Git credential. This name must be unique.
- `name` (String) The name of this Git Credential.
- `password` (String, Sensitive) The password for the Git credential.
- `username` (String) The username for the Git credential.

### Optional

- `description` (String) The description of this Git credential.
- `description` (String) The description of this Git Credential.
- `id` (String) The unique ID for this resource.
- `space_id` (String) The space ID associated with this resource.
- `space_id` (String) The space ID associated with this Git Credential.
- `type` (String) The Git credential authentication type.


38 changes: 19 additions & 19 deletions docs/resources/lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ resource "octopusdeploy_lifecycle" "example" {
name = "foo"
release_retention_policy {
quantity_to_keep = 0
should_keep_forever = true
quantity_to_keep = 0
should_keep_forever = true // true only if quantity_to_keep = 0
unit = "Days"
}
Expand Down Expand Up @@ -64,10 +64,10 @@ resource "octopusdeploy_lifecycle" "example" {

- `description` (String) The description of this lifecycle.
- `id` (String) The unique ID for this resource.
- `phase` (Block List) (see [below for nested schema](#nestedblock--phase))
- `release_retention_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--release_retention_policy))
- `phase` (Block List) Defines a phase in the lifecycle. (see [below for nested schema](#nestedblock--phase))
- `release_retention_policy` (Block List) Defines the retention policy for releases or tentacles. (see [below for nested schema](#nestedblock--release_retention_policy))
- `space_id` (String) The space ID associated with this resource.
- `tentacle_retention_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--tentacle_retention_policy))
- `tentacle_retention_policy` (Block List) Defines the retention policy for releases or tentacles. (see [below for nested schema](#nestedblock--tentacle_retention_policy))

<a id="nestedblock--phase"></a>
### Nested Schema for `phase`
Expand All @@ -83,27 +83,27 @@ Optional:
- `is_optional_phase` (Boolean) If false a release must be deployed to this phase before it can be deployed to the next phase.
- `minimum_environments_before_promotion` (Number) The number of units required before a release can enter the next phase. If 0, all environments are required.
- `optional_deployment_targets` (List of String) Environment IDs in this phase that a release can be deployed to, but is not automatically deployed to
- `release_retention_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--phase--release_retention_policy))
- `tentacle_retention_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--phase--tentacle_retention_policy))
- `release_retention_policy` (Block List) Defines the retention policy for releases or tentacles. (see [below for nested schema](#nestedblock--phase--release_retention_policy))
- `tentacle_retention_policy` (Block List) Defines the retention policy for releases or tentacles. (see [below for nested schema](#nestedblock--phase--tentacle_retention_policy))

<a id="nestedblock--phase--release_retention_policy"></a>
### Nested Schema for `phase.release_retention_policy`

Optional:

- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is `30`. If `0` then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is `false`.
- `unit` (String) The unit of quantity to keep. Valid units are `Days` or `Items`. The default value is `Days`.
- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is 30. If 0 then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is false.
- `unit` (String) The unit of quantity to keep. Valid units are Days or Items. The default value is Days.


<a id="nestedblock--phase--tentacle_retention_policy"></a>
### Nested Schema for `phase.tentacle_retention_policy`

Optional:

- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is `30`. If `0` then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is `false`.
- `unit` (String) The unit of quantity to keep. Valid units are `Days` or `Items`. The default value is `Days`.
- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is 30. If 0 then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is false.
- `unit` (String) The unit of quantity to keep. Valid units are Days or Items. The default value is Days.



Expand All @@ -112,19 +112,19 @@ Optional:

Optional:

- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is `30`. If `0` then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is `false`.
- `unit` (String) The unit of quantity to keep. Valid units are `Days` or `Items`. The default value is `Days`.
- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is 30. If 0 then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is false.
- `unit` (String) The unit of quantity to keep. Valid units are Days or Items. The default value is Days.


<a id="nestedblock--tentacle_retention_policy"></a>
### Nested Schema for `tentacle_retention_policy`

Optional:

- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is `30`. If `0` then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is `false`.
- `unit` (String) The unit of quantity to keep. Valid units are `Days` or `Items`. The default value is `Days`.
- `quantity_to_keep` (Number) The number of days/releases to keep. The default value is 30. If 0 then all are kept.
- `should_keep_forever` (Boolean) Indicates if items should never be deleted. The default value is false.
- `unit` (String) The unit of quantity to keep. Valid units are Days or Items. The default value is Days.

## Import

Expand Down
18 changes: 9 additions & 9 deletions docs/resources/tenant_project_variable.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "octopusdeploy_tenant_project_variable Resource - terraform-provider-octopusdeploy"
subcategory: ""
description: |-
This resource manages tenant project variables in Octopus Deploy.
Manages a tenant project variable in Octopus Deploy.
---

# octopusdeploy_tenant_project_variable (Resource)

This resource manages tenant project variables in Octopus Deploy.
Manages a tenant project variable in Octopus Deploy.



Expand All @@ -17,18 +17,18 @@ This resource manages tenant project variables in Octopus Deploy.

### Required

- `environment_id` (String)
- `project_id` (String)
- `template_id` (String)
- `tenant_id` (String)
- `environment_id` (String) The ID of the environment.
- `project_id` (String) The ID of the project.
- `template_id` (String) The ID of the variable template.
- `tenant_id` (String) The ID of the tenant.

### Optional

- `space_id` (String)
- `value` (String, Sensitive)
- `space_id` (String) The space ID associated with this Tenant Project Variable.
- `value` (String, Sensitive) The value of the variable.

### Read-Only

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


8 changes: 3 additions & 5 deletions octopusdeploy_framework/datasource_git_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy_framework/util"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
"time"
)
Expand All @@ -35,6 +34,7 @@ type GitCredentialModel struct {
Description types.String `tfsdk:"description"`
Type types.String `tfsdk:"type"`
Username types.String `tfsdk:"username"`
Password types.String `tfsdk:"password"`
}

func NewGitCredentialsDataSource() datasource.DataSource {
Expand All @@ -46,10 +46,7 @@ func (g *gitCredentialsDataSource) Metadata(_ context.Context, req datasource.Me
}

func (g *gitCredentialsDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{
Description: "A list of Git Credentials that match the filter(s).",
Attributes: schemas.GetGitCredentialDataSourceSchema(),
}
resp.Schema = schemas.GetGitCredentialDataSourceSchema()
}

func (g *gitCredentialsDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
Expand Down Expand Up @@ -102,6 +99,7 @@ func GetGitCredentialAttrTypes() map[string]attr.Type {
"description": types.StringType,
"type": types.StringType,
"username": types.StringType,
"password": types.StringType,
}
}

Expand Down
Loading

0 comments on commit 7fade05

Please sign in to comment.