Skip to content

Commit

Permalink
remove client.token and update docs for the resource
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-medvedev-codefresh committed Feb 22, 2024
1 parent 3d5f6d6 commit 9d011e1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion codefresh/internal/schemautil/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ func (o *ValidationOptions) setSummary(summary string) *ValidationOptions {
func (o *ValidationOptions) setDetailFormat(detailFormat string) *ValidationOptions {
o.detailFormat = detailFormat
return o
}
}
5 changes: 1 addition & 4 deletions codefresh/resource_api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ func resourceApiKeyCreate(d *schema.ResourceData, meta interface{}) error {
return err
}

client.Token = resp

// Codefresh tokens are in the form xxxxxxxxxxxx.xxxxxxxxx the first half serves as the id
d.SetId(strings.Split(client.Token,".")[0])
d.SetId(strings.Split(resp, ".")[0])

return nil
}
Expand All @@ -118,7 +116,6 @@ func resourceApiKeyRead(d *schema.ResourceData, meta interface{}) error {
return errors.New("[ERROR] Can't read API Key. Token is empty.")
}


apiKey, err := client.GetAPIKey(keyID)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions codefresh/resource_pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,8 @@ func TestAccCodefreshPipeline_CronTriggersInvalid(t *testing.T) {
var pipeline cfclient.Pipeline

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCodefreshPipelineBasicConfigCronTriggers(
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/api_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ description: |-

Manages an API Key tied to an Account and a User.

terraform-provider-codefresh itself uses an API key, passed as provider's attribute, but it's possible to use that API Key to generate a new one.

terraform-provider-codefresh itself uses an API key, passed as provider's attribute, but it's possible to use that API Key to generate a new one.
This resource requires Codefresh system admin permissions, hence is relevant for on-prem deployments of Codefresh only.


## Example usage
Expand Down
4 changes: 2 additions & 2 deletions templates/resources/api_key.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ description: |-

{{ .Description | trimspace }}

{{ .ProviderName }} itself uses an API key, passed as provider's attribute, but it's possible to use that API Key to generate a new one.

{{ .ProviderName }} itself uses an API key, passed as provider's attribute, but it's possible to use that API Key to generate a new one.
This resource requires Codefresh system admin permissions, hence is relevant for on-prem deployments of Codefresh only.


## Example usage
Expand Down

0 comments on commit 9d011e1

Please sign in to comment.