From 7f7a97f4196344cb0b35d451f63b47f08f718e66 Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Sun, 5 Mar 2023 13:24:38 +0200 Subject: [PATCH 1/9] WIP --- .github/ISSUE_TEMPLATE.yaml | 62 +++ .github/PULL_REQUEST_TEMPLATE.md | 3 +- .github/release-drafter.yaml | 4 +- CONTRIBUTING.md | 7 + GNUmakefile | 27 +- README.md | 55 +-- codefresh/data_account.go | 4 +- codefresh/data_context.go | 3 +- codefresh/data_current_account.go | 4 +- codefresh/{resource_idp.go => data_idps.go} | 6 +- codefresh/data_registry.go | 3 +- codefresh/data_step_types.go | 3 +- codefresh/data_team.go | 4 +- codefresh/data_user.go | 6 +- codefresh/data_users.go | 6 +- codefresh/env.go | 10 + codefresh/provider.go | 15 +- codefresh/resource_account.go | 59 +-- codefresh/resource_account_admins.go | 5 + codefresh/resource_api_key.go | 47 ++- codefresh/resource_context.go | 40 +- codefresh/resource_idp_accounts.go | 14 +- codefresh/resource_permission.go | 41 +- codefresh/resource_pipeline.go | 378 ++++++++++++------ codefresh/resource_pipeline_cron_trigger.go | 9 +- codefresh/resource_project.go | 20 +- codefresh/resource_registry.go | 201 ++++++---- codefresh/resource_step_types.go | 28 +- codefresh/resource_team.go | 37 +- codefresh/resource_user.go | 94 +++-- docs/README.md | 55 --- docs/data-sources/account.md | 63 +++ docs/{data => data-sources}/context.md | 26 +- docs/data-sources/current_account.md | 76 ++++ docs/data-sources/idps.md | 102 +++++ docs/{data => data-sources}/registry.md | 35 +- docs/data-sources/step_types.md | 48 +++ docs/data-sources/team.md | 44 ++ docs/data-sources/user.md | 91 +++++ docs/data-sources/users.md | 84 ++++ docs/data/step-types.md | 34 -- docs/data/team.md | 20 - docs/data/user.md | 59 --- docs/data/users.md | 14 - docs/developer.md | 38 -- docs/guides/development.md | 71 ++++ docs/index.md | 52 +++ docs/modules/account_token.md | 51 --- docs/modules/accounts_users.md | 4 - docs/modules/teams.md | 4 - docs/resources/account.md | 69 +++- docs/resources/account_admins.md | 75 ++++ docs/resources/api-key.md | 94 ----- docs/resources/api_key.md | 109 +++++ docs/resources/context.md | 183 +++++++-- docs/resources/idp_accounts.md | 47 +++ docs/resources/permission.md | 65 +++ docs/resources/permissions.md | 49 --- docs/resources/pipeline.md | 226 ++++++----- docs/resources/pipeline_cron_trigger.md | 27 +- docs/resources/project.md | 34 +- docs/resources/registry.md | 238 +++++------ docs/resources/step_types.md | 72 ++++ docs/resources/team.md | 38 +- docs/resources/user.md | 79 ++-- go.mod | 131 +++++- go.sum | 61 +-- main.go | 31 +- .../data-sources/account.md.tmpl | 19 +- templates/data-sources/context.md.tmpl | 54 +++ .../data-sources/current_account.md.tmpl | 18 +- .../data-sources/idps.md.tmpl | 18 +- templates/data-sources/registry.md.tmpl | 36 ++ templates/data-sources/step_types.md.tmpl | 30 ++ templates/data-sources/team.md.tmpl | 30 ++ templates/data-sources/user.md.tmpl | 30 ++ templates/data-sources/users.md.tmpl | 19 + templates/guides/development.md.tmpl | 71 ++++ templates/index.md.tmpl | 46 +++ templates/resources/account.md.tmpl | 45 +++ .../resources/account_admins.md.tmpl | 22 +- templates/resources/api_key.md.tmpl | 75 ++++ templates/resources/context.md.tmpl | 98 +++++ .../resources/idp_accounts.md.tmpl | 17 +- templates/resources/permission.md.tmpl | 38 ++ templates/resources/pipeline.md.tmpl | 100 +++++ .../resources/pipeline_cron_trigger.md.tmpl | 35 ++ templates/resources/project.md.tmpl | 37 ++ templates/resources/registry.md.tmpl | 85 ++++ .../resources/step_types.md.tmpl | 26 +- templates/resources/team.md.tmpl | 28 ++ templates/resources/user.md.tmpl | 72 ++++ tf_modules/accounts_users/vars.tf | 33 -- 93 files changed, 3526 insertions(+), 1350 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.yaml create mode 100644 CONTRIBUTING.md rename codefresh/{resource_idp.go => data_idps.go} (96%) create mode 100644 codefresh/env.go delete mode 100644 docs/README.md create mode 100644 docs/data-sources/account.md rename docs/{data => data-sources}/context.md (67%) create mode 100644 docs/data-sources/current_account.md create mode 100644 docs/data-sources/idps.md rename docs/{data => data-sources}/registry.md (53%) create mode 100644 docs/data-sources/step_types.md create mode 100644 docs/data-sources/team.md create mode 100644 docs/data-sources/user.md create mode 100644 docs/data-sources/users.md delete mode 100644 docs/data/step-types.md delete mode 100644 docs/data/team.md delete mode 100644 docs/data/user.md delete mode 100644 docs/data/users.md delete mode 100644 docs/developer.md create mode 100644 docs/guides/development.md create mode 100644 docs/index.md delete mode 100644 docs/modules/account_token.md delete mode 100644 docs/modules/accounts_users.md delete mode 100644 docs/modules/teams.md create mode 100644 docs/resources/account_admins.md delete mode 100644 docs/resources/api-key.md create mode 100644 docs/resources/api_key.md create mode 100644 docs/resources/idp_accounts.md create mode 100644 docs/resources/permission.md delete mode 100644 docs/resources/permissions.md create mode 100644 docs/resources/step_types.md rename docs/data/account.md => templates/data-sources/account.md.tmpl (63%) create mode 100644 templates/data-sources/context.md.tmpl rename docs/data/current_accont.md => templates/data-sources/current_account.md.tmpl (68%) rename docs/data/idps.md => templates/data-sources/idps.md.tmpl (78%) create mode 100644 templates/data-sources/registry.md.tmpl create mode 100644 templates/data-sources/step_types.md.tmpl create mode 100644 templates/data-sources/team.md.tmpl create mode 100644 templates/data-sources/user.md.tmpl create mode 100644 templates/data-sources/users.md.tmpl create mode 100644 templates/guides/development.md.tmpl create mode 100644 templates/index.md.tmpl create mode 100644 templates/resources/account.md.tmpl rename docs/resources/account-admins.md => templates/resources/account_admins.md.tmpl (67%) create mode 100644 templates/resources/api_key.md.tmpl create mode 100644 templates/resources/context.md.tmpl rename docs/resources/idp-accounts.md => templates/resources/idp_accounts.md.tmpl (50%) create mode 100644 templates/resources/permission.md.tmpl create mode 100644 templates/resources/pipeline.md.tmpl create mode 100644 templates/resources/pipeline_cron_trigger.md.tmpl create mode 100644 templates/resources/project.md.tmpl create mode 100644 templates/resources/registry.md.tmpl rename docs/resources/step-types.md => templates/resources/step_types.md.tmpl (63%) create mode 100644 templates/resources/team.md.tmpl create mode 100644 templates/resources/user.md.tmpl diff --git a/.github/ISSUE_TEMPLATE.yaml b/.github/ISSUE_TEMPLATE.yaml new file mode 100644 index 00000000..9d0d058c --- /dev/null +++ b/.github/ISSUE_TEMPLATE.yaml @@ -0,0 +1,62 @@ +name: Bug Report +description: File a bug report +title: "[Bug]: " +labels: ["bug", "triage"] +assignees: + - octocat +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: input + id: contact + attributes: + label: Contact Details + description: How can we get in touch with you if we need more info? + placeholder: ex. email@example.com + validations: + required: false + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + value: "A bug happened!" + validations: + required: true + - type: dropdown + id: version + attributes: + label: Version + description: What version of our software are you running? + options: + - 1.0.2 (Default) + - 1.0.3 (Edge) + validations: + required: true + - type: dropdown + id: browsers + attributes: + label: What browsers are you seeing the problem on? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) + options: + - label: I agree to follow this project's Code of Conduct + required: true \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 2c631aa4..900617ec 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,7 +7,8 @@ ## PR Checklist +* [ ] _I have read [CONTRIBUTING.md](https://github.com/codefresh-io/terraform-provider-codefresh/blob/master/README.md)._ * [ ] _I have [allowed changes to my fork to be made](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)._ * [ ] _I have added tests, assuming new tests are warranted_. * [ ] _I have updated the Terraform docs in this repo, assuming any changes to the schema of Resources or Data Sources have been made._ -* [ ] _I understand that the `/test` comment will be ignored by the CI trigger [unless it is made by a repo admin or collaborator](https://codefresh.io/docs/docs/pipelines/triggers/git-triggers/#support-for-building-pull-requests-from-forks)._ +* [ ] _I understand that the `/test` comment will be ignored by the CI trigger [unless it is made by a repo admin or collaborator](https://codefresh.io/docs/docs/pipelines/triggers/git-triggers/#support-for-building-pull-requests-from-forks)._ \ No newline at end of file diff --git a/.github/release-drafter.yaml b/.github/release-drafter.yaml index 2db37dc3..643a671c 100644 --- a/.github/release-drafter.yaml +++ b/.github/release-drafter.yaml @@ -14,6 +14,8 @@ categories: label: "chore" change-template: "- $TITLE @$AUTHOR (#$NUMBER)" change-title-escapes: '\<*_&' +exclude-labels: + - "no-release" version-resolver: major: labels: @@ -32,4 +34,4 @@ version-resolver: default: patch template: | ## Changes - $CHANGES \ No newline at end of file + $CHANGES diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..de455afe --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,7 @@ +# Contributing + +## Updating Provider Documentation + +```bash +make docs +``` \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index cda90334..c436c952 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -7,6 +7,7 @@ NAMESPACE=app BINARY=terraform-provider-${PKG_NAME} VERSION=0.2.1 OS_ARCH=darwin_amd64 +TFPLUGINDOCS_VERSION=v0.14.1 default: build @@ -20,8 +21,7 @@ build: fmtcheck go build -o ${BINARY} install: build - mkdir -p ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${PKG_NAME}/${VERSION}/${OS_ARCH} - mv ${BINARY} ~/.terraform.d/plugins/${HOSTNAME}/${NAMESPACE}/${PKG_NAME}/${VERSION}/${OS_ARCH} + mv ${BINARY} $(HOME)/go/bin/ fmt: @echo "==> Fixing source code with gofmt..." @@ -59,22 +59,9 @@ vet: exit 1; \ fi -website: -ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) - echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..." - git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO) -endif - @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) +docs: + @echo "==> Generating Provider Documentation..." + which tfplugindocs || go get github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@${TFPLUGINDOCS_VERSION} + tfplugindocs generate -website-lint: - @echo "==> Checking website against linters..." - @misspell -error -source=text website/ - -website-test: -ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO))) - echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..." - git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO) -endif - @$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME) - -.PHONY: build test testacc vet fmt fmtcheck lint tools test-compile website website-lint website-test +.PHONY: build test testacc vet fmt fmtcheck lint tools test-compile docs diff --git a/README.md b/README.md index 42209ff6..099e940d 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# Terraform provider for Codefresh +# Terraform Provider for Codefresh -This provider was initialized by [LightStep](https://lightstep.com/) and will be maintained as the official Terraform provider for Codefresh. +This is the official Terraform Provider for Codefresh. -The provider is still under development, and can be used as a terraform [third-party plugin](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins) only. +Terraform Registry: [registry.terraform.io/providers/codefresh-io/codefresh](https://registry.terraform.io/providers/codefresh-io/codefresh/latest) ## Requirements -- [Terraform](https://www.terraform.io/downloads.html) 0.12+ ; -- [Go](https://golang.org/doc/install) 1.12+ (to build the provider plugin). +- [Terraform](https://www.terraform.io/downloads.html) `1.x.x` ; + +## Download the Provider -## Download Provider Download and extract terraform-provider-codefresh from [releases](https://github.com/codefresh-io/terraform-provider-codefresh/releases) ## Building the Provider @@ -20,34 +20,21 @@ go build -o terraform-provider-codefresh ## Using the Provider -Compile or take from the [Releases](https://github.com/codefresh-contrib/terraform-provider-codefresh/releases) `terraform-provider-codefresh` binary and place it locally according the Terraform plugins [documentation](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins). - -### for terraform 0.12: -- _~/.terraform.d/plugins/linux\_amd64_ -- _./terraform.d/plugins/linux\_amd64_. The relative path in your Terraform project. - -### for terraform 0.13 follow [required providers](https://www.terraform.io/docs/configuration/provider-requirements.html): -```bash -# OS is linux|windows|darwin, ARCH is amd64|arm|x86 -PLUGIN_DIR=~/.terraform.d/plugins/codefresh.io/app/codefresh/0.1.0/ -mkdir -p ${PLUGIN_DIR} -cp terraform-provider-codefresh ${PLUGIN_DIR}/ -``` +In `versions.tf`: -add [required_providers block](https://www.terraform.io/docs/configuration/provider-requirements.html#requiring-providers) ```terraform terraform { - required_providers { codefresh = { - version = "0.1.0" - source = "codefresh.io/app/codefresh" + version = "x.y.z" # Optional but recommended; replace with latest semantic version + source = "codefresh.io/codefresh" } } } ``` + ## [Documentation](./docs) ## [Examples](./examples) @@ -78,11 +65,27 @@ export CODEFRESH_API_KEY='xyz' ## Testing the Provider ```bash -export TF_ACC="test" -export CODEFRESH_API_KEY=[YOUR API TOKEN] -go test -v ./... +make testacc ``` +## Contributors + +[![All Contributors](https://img.shields.io/github/all-contributors/codefresh-io/terraform-provider-aws?color=ee8449&style=flat-square)](#contributors) + + + + + + + + + + + +## Acknowledgements + +_This provider was initialized by [LightStep](https://lightstep.com/)_. + ## License Copyright 2023 Codefresh. diff --git a/codefresh/data_account.go b/codefresh/data_account.go index 962a51ef..e6e5ffc1 100644 --- a/codefresh/data_account.go +++ b/codefresh/data_account.go @@ -2,13 +2,15 @@ package codefresh import ( "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceAccount() *schema.Resource { return &schema.Resource{ - Read: dataSourceAccountRead, + Description: "This data source retrieves an account by _id or name.", + Read: dataSourceAccountRead, Schema: map[string]*schema.Schema{ "_id": { Type: schema.TypeString, diff --git a/codefresh/data_context.go b/codefresh/data_context.go index 327f9971..ddabff6b 100644 --- a/codefresh/data_context.go +++ b/codefresh/data_context.go @@ -10,7 +10,8 @@ import ( func dataSourceContext() *schema.Resource { return &schema.Resource{ - Read: dataSourceContextRead, + Description: "This data source allows to retrieve information on any defined context.", + Read: dataSourceContextRead, Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, diff --git a/codefresh/data_current_account.go b/codefresh/data_current_account.go index be222ba5..3214823b 100644 --- a/codefresh/data_current_account.go +++ b/codefresh/data_current_account.go @@ -2,13 +2,15 @@ package codefresh import ( "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceCurrentAccount() *schema.Resource { return &schema.Resource{ - Read: dataSourceCurrentAccountRead, + Description: "Returns the current account (owner of the token) and its users.", + Read: dataSourceCurrentAccountRead, Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, diff --git a/codefresh/resource_idp.go b/codefresh/data_idps.go similarity index 96% rename from codefresh/resource_idp.go rename to codefresh/data_idps.go index e6d6635a..9c6b8c8f 100644 --- a/codefresh/resource_idp.go +++ b/codefresh/data_idps.go @@ -2,14 +2,16 @@ package codefresh import ( "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceIdps() *schema.Resource { return &schema.Resource{ - Read: dataSourceIdpRead, - Schema: IdpSchema(), + Description: "This data source retrieves all Identity Providers (IdPs) in the system.", + Read: dataSourceIdpRead, + Schema: IdpSchema(), } } diff --git a/codefresh/data_registry.go b/codefresh/data_registry.go index 0653f707..4e0ea86f 100644 --- a/codefresh/data_registry.go +++ b/codefresh/data_registry.go @@ -9,7 +9,8 @@ import ( func dataSourceRegistry() *schema.Resource { return &schema.Resource{ - Read: dataSourceRegistryRead, + Description: "This data source allows retrieving information on any existing registry.", + Read: dataSourceRegistryRead, Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, diff --git a/codefresh/data_step_types.go b/codefresh/data_step_types.go index 928eefc9..07eca94f 100644 --- a/codefresh/data_step_types.go +++ b/codefresh/data_step_types.go @@ -10,7 +10,8 @@ import ( func dataSourceStepTypes() *schema.Resource { return &schema.Resource{ - Read: dataSourceStepTypesRead, + Description: "This data source allows to retrieve the published versions of step-types.", + Read: dataSourceStepTypesRead, Schema: map[string]*schema.Schema{ "name": { Type: schema.TypeString, diff --git a/codefresh/data_team.go b/codefresh/data_team.go index 772ce886..aa340c84 100644 --- a/codefresh/data_team.go +++ b/codefresh/data_team.go @@ -2,13 +2,15 @@ package codefresh import ( "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceTeam() *schema.Resource { return &schema.Resource{ - Read: dataSourceTeamRead, + Description: "This data source retrieves a team by its ID or name.", + Read: dataSourceTeamRead, Schema: map[string]*schema.Schema{ "_id": { Type: schema.TypeString, diff --git a/codefresh/data_user.go b/codefresh/data_user.go index 597535bf..ed7f91f8 100644 --- a/codefresh/data_user.go +++ b/codefresh/data_user.go @@ -3,14 +3,16 @@ package codefresh import ( "errors" "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func dataSourceUser() *schema.Resource { return &schema.Resource{ - Read: dataSourceUserRead, - Schema: *UserSchema(), + Description: "This data source retrieves a user by email.", + Read: dataSourceUserRead, + Schema: *UserSchema(), } } diff --git a/codefresh/data_users.go b/codefresh/data_users.go index d1bf5857..5495d6bd 100644 --- a/codefresh/data_users.go +++ b/codefresh/data_users.go @@ -1,14 +1,16 @@ package codefresh import ( + "time" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "time" ) func dataSourceUsers() *schema.Resource { return &schema.Resource{ - Read: dataSourceUsersRead, + Description: "This data source retrieves all users in the system.", + Read: dataSourceUsersRead, Schema: map[string]*schema.Schema{ "users": { Type: schema.TypeList, diff --git a/codefresh/env.go b/codefresh/env.go new file mode 100644 index 00000000..8e16a185 --- /dev/null +++ b/codefresh/env.go @@ -0,0 +1,10 @@ +package codefresh + +const ( + ENV_CODEFRESH_PLUGIN_DEBUG = "CODEFRESH_PLUGIN_DEBUG" + ENV_CODEFRESH_PLUGIN_ADDR = "CODEFRESH_PLUGIN_ADDR" + ENV_CODEFRESH_API_URL = "CODEFRESH_API_URL" + ENV_CODEFRESH_API_KEY = "CODEFRESH_API_KEY" + DEFAULT_CODEFRESH_API_URL = "https://g.codefresh.io/api" + DEFAULT_CODEFRESH_PLUGIN_ADDR = "registry.terraform.io/-/codefresh" +) diff --git a/codefresh/provider.go b/codefresh/provider.go index f388e816..4e90198f 100644 --- a/codefresh/provider.go +++ b/codefresh/provider.go @@ -1,10 +1,11 @@ package codefresh import ( + "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - //"github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "os" ) @@ -15,15 +16,17 @@ func Provider() *schema.Provider { Type: schema.TypeString, Optional: true, DefaultFunc: func() (interface{}, error) { - if url := os.Getenv("CODEFRESH_API_URL"); url != "" { + if url := os.Getenv(ENV_CODEFRESH_API_URL); url != "" { return url, nil } - return "https://g.codefresh.io/api", nil + return DEFAULT_CODEFRESH_API_URL, nil }, + Description: fmt.Sprintf("The Codefresh API URL. Defaults to `%s`. Can also be set using the `%s` environment variable.", DEFAULT_CODEFRESH_API_URL, ENV_CODEFRESH_API_URL), }, "token": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Description: fmt.Sprintf("The Codefresh API token. Can also be set using the `%s` environment variable.", ENV_CODEFRESH_API_KEY), }, }, DataSourcesMap: map[string]*schema.Resource{ @@ -61,7 +64,7 @@ func configureProvider(d *schema.ResourceData) (interface{}, error) { apiURL := d.Get("api_url").(string) token := d.Get("token").(string) if token == "" { - token = os.Getenv("CODEFRESH_API_KEY") + token = os.Getenv(ENV_CODEFRESH_API_KEY) } return cfClient.NewClient(apiURL, token, ""), nil } diff --git a/codefresh/resource_account.go b/codefresh/resource_account.go index 9e6f9317..b048bf11 100644 --- a/codefresh/resource_account.go +++ b/codefresh/resource_account.go @@ -7,6 +7,9 @@ import ( func resourceAccount() *schema.Resource { return &schema.Resource{ + Description: ` + By creating different accounts for different teams within the same company a customer can achieve complete segregation of assets between the teams. + `, Create: resourceAccountCreate, Read: resourceAccountRead, Update: resourceAccountUpdate, @@ -16,18 +19,20 @@ func resourceAccount() *schema.Resource { }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Description: "The display name for the account.", + Type: schema.TypeString, + Required: true, }, - // "admins": { - // Type: schema.TypeSet, - // Optional: true, - // Elem: &schema.Schema{ - // Type: schema.TypeString, - // }, - // }, - "features": { + Description: ` +Features toggles for this account. Default: + +OfflineLogging: true +ssoManagement: true +teamsManagement: true +abac: true +customKubernetesCluster: true +`, Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{ @@ -42,35 +47,41 @@ func resourceAccount() *schema.Resource { }, }, "limits": { - Type: schema.TypeList, - Optional: true, + Description: "Limits for this account.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "collaborators": { - Type: schema.TypeInt, - Required: true, + Description: "The number of collaborators allowed for this account.", + Type: schema.TypeInt, + Required: true, }, "data_retention_weeks": { - Type: schema.TypeInt, - Optional: true, - Default: 5, + Description: "Specifies how long, in weeks, the builds be stored (default: `5`).", + Type: schema.TypeInt, + Optional: true, + Default: 5, }, }, }, }, "build": { - Type: schema.TypeList, - Optional: true, + Description: "Build limits for this account.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "parallel": { - Type: schema.TypeInt, - Required: true, + Description: "The number of parallel builds allowed for this account.", + Type: schema.TypeInt, + Required: true, }, "nodes": { - Type: schema.TypeInt, - Default: 1, - Optional: true, + Description: "The number of nodes allowed for this account (default: `1`).", + Type: schema.TypeInt, + Default: 1, + Optional: true, }, }, }, diff --git a/codefresh/resource_account_admins.go b/codefresh/resource_account_admins.go index d34b32f7..4dd05032 100644 --- a/codefresh/resource_account_admins.go +++ b/codefresh/resource_account_admins.go @@ -7,6 +7,9 @@ import ( func resourceAccountAdmins() *schema.Resource { return &schema.Resource{ + Description: ` + Use this resource to set a list of admins for any account. + `, Create: resourceAccountAdminsCreate, Read: resourceAccountAdminsRead, Update: resourceAccountAdminsUpdate, @@ -16,10 +19,12 @@ func resourceAccountAdmins() *schema.Resource { }, Schema: map[string]*schema.Schema{ "account_id": { + Description: "The account id where to set up a list of admins.", Type: schema.TypeString, Required: true, }, "users": { + Description: "A list of users to set up as account admins.", Type: schema.TypeSet, Required: true, Elem: &schema.Schema{ diff --git a/codefresh/resource_api_key.go b/codefresh/resource_api_key.go index 5cb974e8..12c4d409 100644 --- a/codefresh/resource_api_key.go +++ b/codefresh/resource_api_key.go @@ -3,12 +3,16 @@ package codefresh import ( "errors" "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceApiKey() *schema.Resource { return &schema.Resource{ + Description: ` + Manages an API Key tied to an Account and a User. + `, Create: resourceApiKeyCreate, Read: resourceApiKeyRead, Update: resourceApiKeyUpdate, @@ -18,23 +22,48 @@ func resourceApiKey() *schema.Resource { }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Description: "The display name for the API key.", + Type: schema.TypeString, + Required: true, }, "account_id": { - Type: schema.TypeString, - Required: true, + Description: "The ID of account in which the API key will be created.", + Type: schema.TypeString, + Required: true, }, "user_id": { - Type: schema.TypeString, - Required: true, + Description: "The ID of a user within the referenced `account_id` that will own the API key.", + Type: schema.TypeString, + Required: true, }, "token": { - Type: schema.TypeString, - Computed: true, - Sensitive: true, + Description: "The resulting API key.", + Type: schema.TypeString, + Computed: true, + Sensitive: true, }, "scopes": { + Description: ` +A list of access scopes for the API key. The possible values: + * agent + * agents + * audit + * build + * cluster + * clusters + * environments-v2 + * github-action + * helm + * kubernetes + * pipeline + * project + * repos + * runner-installation + * step-type + * step-types + * view + * workflow + `, Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{ diff --git a/codefresh/resource_context.go b/codefresh/resource_context.go index 5a135d73..eba49e94 100644 --- a/codefresh/resource_context.go +++ b/codefresh/resource_context.go @@ -1,9 +1,10 @@ package codefresh import ( - storageContext "github.com/codefresh-io/terraform-provider-codefresh/codefresh/context" "log" + storageContext "github.com/codefresh-io/terraform-provider-codefresh/codefresh/context" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/ghodss/yaml" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -40,23 +41,26 @@ func getConflictingContexts(context string) []string { func resourceContext() *schema.Resource { return &schema.Resource{ - Create: resourceContextCreate, - Read: resourceContextRead, - Update: resourceContextUpdate, - Delete: resourceContextDelete, + Description: "A Context is an authentication/configuration that is used by the Codefresh system and engine.", + Create: resourceContextCreate, + Read: resourceContextRead, + Update: resourceContextUpdate, + Delete: resourceContextDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Description: "The display name for the context.", + Type: schema.TypeString, + Required: true, + ForceNew: true, }, "spec": { - Type: schema.TypeList, - Required: true, - MaxItems: 1, + Description: "The context's specs.", + Type: schema.TypeList, + Required: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ normalizeFieldName(contextConfig): { @@ -68,8 +72,9 @@ func resourceContext() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": { - Type: schema.TypeMap, - Required: true, + Description: "The map of variables representing the shared config.", + Type: schema.TypeMap, + Required: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -86,9 +91,10 @@ func resourceContext() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": { - Type: schema.TypeMap, - Required: true, - Sensitive: true, + Description: "The map of variables representing the shared config (secret).", + Type: schema.TypeMap, + Required: true, + Sensitive: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -105,6 +111,7 @@ func resourceContext() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": { + Description: "The YAML string representing the shared config.", Type: schema.TypeString, Required: true, ValidateFunc: stringIsYaml, @@ -126,6 +133,7 @@ func resourceContext() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": { + Description: "The YAML string representing the shared config (secret).", Type: schema.TypeString, Required: true, Sensitive: true, diff --git a/codefresh/resource_idp_accounts.go b/codefresh/resource_idp_accounts.go index b17d764b..f836c228 100644 --- a/codefresh/resource_idp_accounts.go +++ b/codefresh/resource_idp_accounts.go @@ -7,6 +7,10 @@ import ( func resourceIDPAccounts() *schema.Resource { return &schema.Resource{ + Description: ` +This resource adds the list of provided account IDs to the IDP. +Because of the current Codefresh API limitation it's impossible to remove account from IDP, thus deletion is not supported. + `, Create: resourceAccountIDPCreate, Read: resourceAccountIDPRead, Update: resourceAccountIDPUpdate, @@ -16,12 +20,14 @@ func resourceIDPAccounts() *schema.Resource { }, Schema: map[string]*schema.Schema{ "idp_id": { - Type: schema.TypeString, - Required: true, + Description: "The IdP name.", + Type: schema.TypeString, + Required: true, }, "account_ids": { - Type: schema.TypeSet, - Required: true, + Description: "A list of account IDs to add to the IdP.", + Type: schema.TypeSet, + Required: true, Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/codefresh/resource_permission.go b/codefresh/resource_permission.go index 9124d389..9c1b6f92 100644 --- a/codefresh/resource_permission.go +++ b/codefresh/resource_permission.go @@ -10,24 +10,32 @@ import ( func resourcePermission() *schema.Resource { return &schema.Resource{ - Create: resourcePermissionCreate, - Read: resourcePermissionRead, - Update: resourcePermissionUpdate, - Delete: resourcePermissionDelete, + Description: "Permission are used to setup access control and allow to define which teams have access to which clusters and pipelines based on tags.", + Create: resourcePermissionCreate, + Read: resourcePermissionRead, + Update: resourcePermissionUpdate, + Delete: resourcePermissionDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Description: "The permission ID.", + Type: schema.TypeString, + Optional: true, + Computed: true, }, "team": { - Type: schema.TypeString, - Required: true, + Description: "The Id of the team the permissions apply to.", + Type: schema.TypeString, + Required: true, }, "resource": { + Description: ` +The type of resources the permission applies to. Possible values: + * pipeline + * cluster + `, Type: schema.TypeString, Required: true, ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) { @@ -39,6 +47,16 @@ func resourcePermission() *schema.Resource { }, }, "action": { + Description: ` +Action to be allowed. Possible values: + * create + * read + * update + * delete + * run (Only valid for pipeline resource) + * approve (Only valid for pipeline resource) + * debug (Only valid for pipeline resource) + `, Type: schema.TypeString, Required: true, ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) { @@ -50,6 +68,11 @@ func resourcePermission() *schema.Resource { }, }, "tags": { + Description: ` +The effective tags to apply the permission. It supports 2 custom tags: + * untagged is a “tag” which refers to all clusters that don't have any tag. + * (the star character) means all tags. + `, Type: schema.TypeSet, Optional: true, Elem: &schema.Schema{ diff --git a/codefresh/resource_pipeline.go b/codefresh/resource_pipeline.go index 259dcd39..358fecae 100644 --- a/codefresh/resource_pipeline.go +++ b/codefresh/resource_pipeline.go @@ -8,6 +8,8 @@ import ( "strings" cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" + "github.com/hashicorp/go-cty/cty" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "gopkg.in/yaml.v2" @@ -17,248 +19,317 @@ var terminationPolicyOnCreateBranchAttributes = []string{"branchName", "ignoreTr func resourcePipeline() *schema.Resource { return &schema.Resource{ - Create: resourcePipelineCreate, - Read: resourcePipelineRead, - Update: resourcePipelineUpdate, - Delete: resourcePipelineDelete, + Description: "The central component of the Codefresh Platform. Pipelines are workflows that contain individual steps. Each step is responsible for a specific action in the process.", + Create: resourcePipelineCreate, + Read: resourcePipelineRead, + Update: resourcePipelineUpdate, + Delete: resourcePipelineDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Description: "The display name for the pipeline.", + Type: schema.TypeString, + Required: true, }, "original_yaml_string": { + Description: ` +A string with original yaml pipeline. + +For example: + +original_yaml_string = "version: \\"1.0\\"\nsteps:\n test:\n image: alpine:latest\n commands:\n - echo \\"ACC tests\\" + +Or: original_yaml_string = file("/path/to/my/codefresh.yml") + `, Type: schema.TypeString, Optional: true, }, "project_id": { - Type: schema.TypeString, - Computed: true, + Description: "The ID of the project that the pipeline belongs to.", + Type: schema.TypeString, + Computed: true, }, "is_public": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "Boolean that specifies if the build logs are publicly accessible (default: `false`).", + Type: schema.TypeBool, + Optional: true, + Default: false, }, "revision": { - Type: schema.TypeInt, - Computed: true, + Description: "The pipeline's revision. Should be added to the **lifecycle/ignore_changes** or incremented mannually each update.", + Type: schema.TypeInt, + Computed: true, }, "tags": { - Type: schema.TypeSet, - Optional: true, + Description: "A list of tags to mark a project for easy management and access control.", + Type: schema.TypeSet, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "spec": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: "The pipeline's specs.", + Type: schema.TypeList, + Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "priority": { - Type: schema.TypeInt, - Optional: true, - Default: 0, + Description: "Helps to organize the order of builds execution in case of reaching the concurrency limit (default: `0`).", + Type: schema.TypeInt, + Optional: true, + Default: 0, }, "concurrency": { - Type: schema.TypeInt, - Optional: true, - Default: 0, // zero is unlimited + Description: "The maximum amount of concurrent builds. Zero is unlimited (default: `0`).", + Type: schema.TypeInt, + Optional: true, + Default: 0, }, "branch_concurrency": { - Type: schema.TypeInt, - Optional: true, - Default: 0, // zero is unlimited + Description: "The maximum amount of concurrent builds that may run for each branch. Zero is unlimited (default: `0`).", + Type: schema.TypeInt, + Optional: true, + Default: 0, }, "trigger_concurrency": { - Type: schema.TypeInt, - Optional: true, - Default: 0, // zero is unlimited + Description: "The maximum amount of concurrent builds that may run for each trigger (default: `0`).", + Type: schema.TypeInt, + Optional: true, + Default: 0, }, "spec_template": { - Type: schema.TypeList, - Optional: true, + Description: "The pipeline's spec template.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "location": { - Type: schema.TypeString, - Optional: true, - Default: "git", + Description: "The location of the spec template (default: `git`).", + Type: schema.TypeString, + Optional: true, + Default: "git", }, "repo": { - Type: schema.TypeString, - Required: true, + Description: "The repository of the spec template (owner/repo).", + Type: schema.TypeString, + Required: true, }, "path": { - Type: schema.TypeString, - Required: true, + Description: "The relative path to the Codefresh pipeline file.", + Type: schema.TypeString, + Required: true, }, "revision": { - Type: schema.TypeString, - Required: true, + Description: "The git revision of the spec template.", + Type: schema.TypeString, + Required: true, }, "context": { - Type: schema.TypeString, - Optional: true, - Default: "github", + Description: "The Codefresh git context (default: `github`).", + Type: schema.TypeString, + Optional: true, + Default: "github", }, }, }, }, "variables": { - Type: schema.TypeMap, - Optional: true, + Description: "The pipeline's variables.", + Type: schema.TypeMap, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "trigger": { - Type: schema.TypeList, - Optional: true, + Description: "The pipeline's triggers (currently the only nested trigger supported is git; for other trigger types, use the `codefresh_pipeline_*_trigger` resources).", + Type: schema.TypeList, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Optional: true, + Description: "The name of the trigger.", + Type: schema.TypeString, + Optional: true, }, "description": { - Type: schema.TypeString, - Optional: true, + Description: "The description of the trigger.", + Type: schema.TypeString, + Optional: true, }, "type": { - Type: schema.TypeString, - Optional: true, - Default: "git", + Description: "The type of the trigger (default: `git`; see notes above).", + Type: schema.TypeString, + Optional: true, + Default: "git", + ValidateDiagFunc: func(v any, p cty.Path) diag.Diagnostics { + value := v.(string) + expected := "git" + var diags diag.Diagnostics + if value != expected { + diag := diag.Diagnostic{ + Severity: diag.Error, + Summary: "Only triggers of type git are supported for nested triggers. For other trigger types, use the codefresh_pipeline_*_trigger resources.", + Detail: fmt.Sprintf("%q is not %q", value, expected), + } + diags = append(diags, diag) + } + return diags + }, }, "repo": { - Type: schema.TypeString, - Optional: true, + Description: "The repository name, (owner/repo)", + Type: schema.TypeString, + Optional: true, }, "branch_regex": { + Description: " A regular expression and will only trigger for branches that match this naming pattern (default: `/.*/gi`).", Type: schema.TypeString, Optional: true, Default: "/.*/gi", ValidateFunc: stringIsValidRe2RegExp, }, "branch_regex_input": { + Description: "Flag to manage how the `branch_regex` field is interpreted. Possible values: `multiselect-exclude`, `multiselect`, `regex` (default: `regex`).", Type: schema.TypeString, Optional: true, Default: "regex", ValidateFunc: validation.StringInSlice([]string{"multiselect-exclude", "multiselect", "regex"}, false), }, "pull_request_target_branch_regex": { + Description: "A regular expression and will only trigger for pull requests to branches that match this naming pattern.", Type: schema.TypeString, Optional: true, ValidateFunc: stringIsValidRe2RegExp, }, "comment_regex": { + Description: " A regular expression and will only trigger for pull requests where a comment matches this naming pattern (default: `/.*/gi`).", Type: schema.TypeString, Optional: true, Default: "/.*/gi", ValidateFunc: stringIsValidRe2RegExp, }, "modified_files_glob": { - Type: schema.TypeString, - Optional: true, - Default: "", + Description: "Allows to constrain the build and trigger it only if the modified files from the commit match this glob expression (default: `\"\"`).", + Type: schema.TypeString, + Optional: true, + Default: "", }, "events": { - Type: schema.TypeList, - Optional: true, + Description: "A list of GitHub events for which a Pipeline is triggered.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "provider": { - Type: schema.TypeString, - Optional: true, - Default: "github", + Description: "The git provider tied to the trigger.", + Type: schema.TypeString, + Optional: true, + Default: "github", }, "disabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "Flag to disable the trigger.", + Type: schema.TypeBool, + Optional: true, + Default: false, }, "options": { - Type: schema.TypeList, - Optional: true, + Description: "The trigger's options.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "no_cache": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "If true, docker layer cache is disabled", + Type: schema.TypeBool, + Optional: true, + Default: false, }, "no_cf_cache": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "If true, extra Codefresh caching is disabled.", + Type: schema.TypeBool, + Optional: true, + Default: false, }, "reset_volume": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "If true, all files on volume will be deleted before each execution.", + Type: schema.TypeBool, + Optional: true, + Default: false, }, "enable_notifications": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "If false the pipeline will not send notifications to Slack and status updates back to the Git provider.", + Type: schema.TypeBool, + Optional: true, + Default: false, }, }, }, }, "pull_request_allow_fork_events": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "If this trigger is also applicable to git forks.", + Type: schema.TypeBool, + Optional: true, + Default: false, }, "commit_status_title": { - Type: schema.TypeString, - Optional: true, + Description: "The commit status title pushed to the git provider.", + Type: schema.TypeString, + Optional: true, }, "context": { - Type: schema.TypeString, - Optional: true, - Default: "github", + Description: "The Codefresh git context.", + Type: schema.TypeString, + Optional: true, + Default: "github", }, "contexts": { - Type: schema.TypeList, - Optional: true, + Description: "A list of strings representing the contexts ([shared_configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)) to be loaded when the trigger is executed.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "runtime_environment": { - Type: schema.TypeList, - Optional: true, + Description: "The runtime environment for the trigger.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Optional: true, + Description: "The name of the runtime environment.", + Type: schema.TypeString, + Optional: true, }, "memory": { - Type: schema.TypeString, - Optional: true, + Description: "The memory allocated to the runtime environment.", + Type: schema.TypeString, + Optional: true, }, "cpu": { - Type: schema.TypeString, - Optional: true, + Description: "The CPU allocated to the runtime environment.", + Type: schema.TypeString, + Optional: true, }, "dind_storage": { - Type: schema.TypeString, - Optional: true, + Description: "The storage allocated to the runtime environment.", + Type: schema.TypeString, + Optional: true, }, }, }, }, "variables": { - Type: schema.TypeMap, - Optional: true, + Description: "Trigger variables.", + Type: schema.TypeMap, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -267,92 +338,133 @@ func resourcePipeline() *schema.Resource { }, }, "contexts": { - Type: schema.TypeList, - Optional: true, + Description: "A list of strings representing the contexts ([shared_configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)) to be configured for the pipeline.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "termination_policy": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: "The termination policy for the pipeline.", + Type: schema.TypeList, + Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "on_create_branch": { + Description: ` +The following table presents how to configure this block based on the options available in the UI: + +| Option Description | Value Selected | on_create_branch | branch_name | ignore_trigger | ignore_branch | +| ----------------------------------------------------------------------------- |:------------------------:|:----------------:|:-----------:|---------------:| -------------:| +| Once a build is created terminate previous builds from the same branch | Disabled | Omit | N/A | N/A | N/A | +| Once a build is created terminate previous builds from the same branch | From the SAME trigger | Defined | N/A | false | N/A | +| Once a build is created terminate previous builds from the same branch | From ANY trigger | Defined | N/A | true | N/A | +| Once a build is created terminate previous builds only from a specific branch | Disabled | Omit | N/A | N/A | N/A | +| Once a build is created terminate previous builds only from a specific branch | From the SAME trigger | Defined | Regex | false | N/A | +| Once a build is created terminate previous builds only from a specific branch | From ANY trigger | Defined | Regex | true | N/A | +| Once a build is created, terminate all other running builds | Disabled | Omit | N/A | N/A | N/A | +| Once a build is created, terminate all other running builds | From the SAME trigger | Defined | N/A | false | true | +| Once a build is created, terminate all other running builds | From ANY trigger | Defined | N/A | true | true | + `, Type: schema.TypeList, MaxItems: 1, Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "branch_name": { + Description: "A regular expression to filter the branches on with the termination policy applies.", Type: schema.TypeString, Optional: true, ValidateFunc: stringIsValidRe2RegExp, ConflictsWith: []string{"spec.0.termination_policy.0.on_create_branch.0.ignore_branch"}, }, "ignore_trigger": { - Optional: true, - Type: schema.TypeBool, + Description: "Whether to ignore the trigger.", + Optional: true, + Type: schema.TypeBool, }, "ignore_branch": { - Optional: true, - Type: schema.TypeBool, + Description: "Whether to ignore the branch.", + Optional: true, + Type: schema.TypeBool, }, }, }, }, "on_terminate_annotation": { - Optional: true, - Type: schema.TypeBool, - Default: false, + Description: "Enables the policy `Once a build is terminated, terminate all child builds initiated from it`.", + Optional: true, + Type: schema.TypeBool, + Default: false, }, }, }, }, "pack_id": { - Type: schema.TypeString, - Optional: true, + Description: "SAAS pack (`5cd1746617313f468d669013` for Small; `5cd1746717313f468d669014` for Medium; `5cd1746817313f468d669015` for Large; `5cd1746817313f468d669017` for XL; `5cd1746817313f468d669018` for XXL).", + Type: schema.TypeString, + Optional: true, }, "required_available_storage": { - Type: schema.TypeString, - Optional: true, + Description: " Minimum disk space required for build filesystem ( unit Gi is required).", + Type: schema.TypeString, + Optional: true, }, "runtime_environment": { - Type: schema.TypeList, - Optional: true, + Description: "The runtime environment for the pipeline.", + Type: schema.TypeList, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Optional: true, + Description: "The name of the runtime environment.", + Type: schema.TypeString, + Optional: true, }, "memory": { - Type: schema.TypeString, - Optional: true, + Description: "The memory allocated to the runtime environment.", + Type: schema.TypeString, + Optional: true, }, "cpu": { - Type: schema.TypeString, - Optional: true, + Description: "The CPU allocated to the runtime environment.", + Type: schema.TypeString, + Optional: true, }, "dind_storage": { - Type: schema.TypeString, - Optional: true, + Description: "The storage allocated to the runtime environment.", + Type: schema.TypeString, + Optional: true, }, }, }, }, "options": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, + Description: "The options for the pipeline.", + Type: schema.TypeList, + MaxItems: 1, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "keep_pvcs_for_pending_approval": { + Description: ` +When build enters 'Pending Approval' state, volume should: + * Default (attribute not specified): "Use Setting accounts" + * true: "Remain (build remains active)" + * false: "Be removed" + `, Type: schema.TypeBool, Optional: true, }, "pending_approval_concurrency_applied": { + Description: ` +Pipeline concurrency policy: Builds on 'Pending Approval' state should be: + * Default (attribute not specified): "Use Setting accounts" + * true: "Included in concurrency" + * false: "Not included in concurrency" + `, Type: schema.TypeBool, Optional: true, }, diff --git a/codefresh/resource_pipeline_cron_trigger.go b/codefresh/resource_pipeline_cron_trigger.go index de488826..1340a15b 100644 --- a/codefresh/resource_pipeline_cron_trigger.go +++ b/codefresh/resource_pipeline_cron_trigger.go @@ -16,10 +16,11 @@ import ( func resourcePipelineCronTrigger() *schema.Resource { return &schema.Resource{ - Create: resourcePipelineCronTriggerCreate, - Read: resourcePipelineCronTriggerRead, - Update: resourcePipelineCronTriggerUpdate, - Delete: resourcePipelineCronTriggerDelete, + Description: "This resource is used to create cron-based triggers for pipeilnes.", + Create: resourcePipelineCronTriggerCreate, + Read: resourcePipelineCronTriggerRead, + Update: resourcePipelineCronTriggerUpdate, + Delete: resourcePipelineCronTriggerDelete, Importer: &schema.ResourceImporter{ State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { idParts := strings.Split(d.Id(), ",") diff --git a/codefresh/resource_project.go b/codefresh/resource_project.go index 2ad4d42b..6034506a 100644 --- a/codefresh/resource_project.go +++ b/codefresh/resource_project.go @@ -11,6 +11,11 @@ import ( func resourceProject() *schema.Resource { return &schema.Resource{ + Description: ` +The top-level concept in Codefresh. You can create projects to group pipelines that are related. +In most cases a single project will be a single application (that itself contains many micro-services). +You are free to use projects as you see fit. For example, you could create a project for a specific Kubernetes cluster or a specific team/department. + `, Create: resourceProjectCreate, Read: resourceProjectRead, Update: resourceProjectUpdate, @@ -20,19 +25,22 @@ func resourceProject() *schema.Resource { }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Description: "The display name for the project.", + Type: schema.TypeString, + Required: true, }, "tags": { - Type: schema.TypeSet, - Optional: true, + Description: "A list of tags to mark a project for easy management and access control.", + Type: schema.TypeSet, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "variables": { - Type: schema.TypeMap, - Optional: true, + Description: "Project variables.", + Type: schema.TypeMap, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/codefresh/resource_registry.go b/codefresh/resource_registry.go index a869df56..b62e4b90 100644 --- a/codefresh/resource_registry.go +++ b/codefresh/resource_registry.go @@ -30,44 +30,52 @@ var providers = []string{ func resourceRegistry() *schema.Resource { return &schema.Resource{ - Create: resourceRegistryCreate, - Read: resourceRegistryRead, - Update: resourceRegistryUpdate, - Delete: resourceRegistryDelete, + Description: "Registry is the configuration that Codefresh uses to push/pull container images.", + Create: resourceRegistryCreate, + Read: resourceRegistryRead, + Update: resourceRegistryUpdate, + Delete: resourceRegistryDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Description: "The display name for the registry.", + Type: schema.TypeString, + Required: true, }, "kind": { - Type: schema.TypeString, - Computed: true, + Description: "The kind of registry.", + Type: schema.TypeString, + Computed: true, }, "default": { - Type: schema.TypeBool, - Optional: true, - Default: false, + Description: "Whether this registry is the default registry (default: `false`).", + Type: schema.TypeBool, + Optional: true, + Default: false, }, "primary": { - Type: schema.TypeBool, - Optional: true, - Default: true, + Description: "Whether this registry is the primary registry (default: `true`).", + Type: schema.TypeBool, + Optional: true, + Default: true, }, "fallback_registry": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Description: "The name of the fallback registry.", + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, "spec": { - Type: schema.TypeList, - Required: true, - MaxItems: 1, + Description: "The registry's specs.", + Type: schema.TypeList, + Required: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ providerAcr: { + Description: "An `acr` block as documented below ([Azure Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/azure-docker-registry)).", Type: schema.TypeList, ForceNew: true, Optional: true, @@ -76,27 +84,32 @@ func resourceRegistry() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "client_id": { - Type: schema.TypeString, - Required: true, + Description: "The Client ID.", + Type: schema.TypeString, + Required: true, }, "client_secret": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + Description: "The Client Secret.", + Type: schema.TypeString, + Required: true, + Sensitive: true, }, "domain": { - Type: schema.TypeString, - Required: true, + Description: "The ACR registry domain.", + Type: schema.TypeString, + Required: true, }, "repository_prefix": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Description: "See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix).", + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, }, }, }, providerGcr: { + Description: "[Google Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/google-container-registry).", Type: schema.TypeList, ForceNew: true, Optional: true, @@ -105,23 +118,27 @@ func resourceRegistry() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "domain": { - Type: schema.TypeString, - Required: true, + Description: "The GCR registry domain.", + Type: schema.TypeString, + Required: true, }, "keyfile": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + Description: "The serviceaccount json file contents.", + Type: schema.TypeString, + Required: true, + Sensitive: true, }, "repository_prefix": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Description: "See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix).", + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, }, }, }, providerGar: { + Description: "A `gar` block as documented below ([Google Artifact Registry](https://codefresh.io/docs/docs/integrations/docker-registries/google-artifact-registry)).", Type: schema.TypeList, ForceNew: true, Optional: true, @@ -130,23 +147,27 @@ func resourceRegistry() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "location": { - Type: schema.TypeString, - Required: true, + Description: "The GAR location.", + Type: schema.TypeString, + Required: true, }, "keyfile": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + Description: "The serviceaccount json file contents.", + Type: schema.TypeString, + Required: true, + Sensitive: true, }, "repository_prefix": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Description: "See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix).", + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, }, }, }, providerEcr: { + Description: "An `ecr` block as documented below ([Amazon EC2 Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/amazon-ec2-container-registry)).", Type: schema.TypeList, ForceNew: true, Optional: true, @@ -155,27 +176,32 @@ func resourceRegistry() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "region": { - Type: schema.TypeString, - Required: true, + Description: "The AWS region.", + Type: schema.TypeString, + Required: true, }, "access_key_id": { - Type: schema.TypeString, - Required: true, + Description: "The AWS access key ID.", + Type: schema.TypeString, + Required: true, }, "secret_access_key": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + Description: "The AWS secret access key.", + Type: schema.TypeString, + Required: true, + Sensitive: true, }, "repository_prefix": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Description: "See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix).", + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, }, }, }, providerBintray: { + Description: "A `bintray` block as documented below ([Bintray / Artifactory](https://codefresh.io/docs/docs/integrations/docker-registries/bintray-io)).", Type: schema.TypeList, ForceNew: true, Optional: true, @@ -184,27 +210,32 @@ func resourceRegistry() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "username": { - Type: schema.TypeString, - Required: true, + Description: "The Bintray username.", + Type: schema.TypeString, + Required: true, }, "token": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + Description: "The Bintray token.", + Type: schema.TypeString, + Required: true, + Sensitive: true, }, "domain": { - Type: schema.TypeString, - Required: true, + Description: "The Bintray domain.", + Type: schema.TypeString, + Required: true, }, "repository_prefix": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Description: "See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix).", + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, }, }, }, providerDockerhub: { + Description: "A `dockerhub` block as documented below ([Docker Hub Registry](https://codefresh.io/docs/docs/integrations/docker-registries/docker-hub/)).", Type: schema.TypeList, ForceNew: true, Optional: true, @@ -213,18 +244,21 @@ func resourceRegistry() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "username": { - Type: schema.TypeString, - Required: true, + Description: "The DockerHub username.", + Type: schema.TypeString, + Required: true, }, "password": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + Description: "The DockerHub password.", + Type: schema.TypeString, + Required: true, + Sensitive: true, }, }, }, }, providerOther: { + Description: "`other` provider block described below ([Other Providers](https://codefresh.io/docs/docs/integrations/docker-registries/other-registries)).", Type: schema.TypeList, ForceNew: true, Optional: true, @@ -233,24 +267,29 @@ func resourceRegistry() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "username": { - Type: schema.TypeString, - Required: true, + Description: "The username.", + Type: schema.TypeString, + Required: true, }, "password": { - Type: schema.TypeString, - Required: true, - Sensitive: true, + Description: "The password.", + Type: schema.TypeString, + Required: true, + Sensitive: true, }, "domain": { - Type: schema.TypeString, - Required: true, + Description: "The domain.", + Type: schema.TypeString, + Required: true, }, "repository_prefix": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, + Description: "See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix).", + Type: schema.TypeString, + Optional: true, + ForceNew: true, }, "behind_firewall": { + Description: "See the [docs](https://codefresh.io/docs/docs/administration/behind-the-firewall/#accessing-an-internal-docker-registry).", Type: schema.TypeBool, Optional: true, Default: false, diff --git a/codefresh/resource_step_types.go b/codefresh/resource_step_types.go index 85ef5a4e..2f5a9c36 100644 --- a/codefresh/resource_step_types.go +++ b/codefresh/resource_step_types.go @@ -21,6 +21,10 @@ import ( func resourceStepTypes() *schema.Resource { return &schema.Resource{ + Description: ` +This resource allows to create your own typed step and manage all of its published versions. +The resource allows to handle the life-cycle of the version by allowing specifying multiple blocks 'version' where the user provides a version number and the yaml file representing the plugin. + `, CreateContext: resourceStepTypesCreate, ReadContext: resourceStepTypesRead, UpdateContext: resourceStepTypesUpdate, @@ -30,23 +34,27 @@ func resourceStepTypes() *schema.Resource { }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - ForceNew: true, - Required: true, + Description: "The name for the step-type", + Type: schema.TypeString, + ForceNew: true, + Required: true, }, "version": { - Type: schema.TypeSet, - Required: true, - MinItems: 1, - Set: resourceStepTypesVersionsConfigHash, - ConfigMode: schema.SchemaConfigModeAttr, + Description: "The versions of the step-type", + Type: schema.TypeSet, + Required: true, + MinItems: 1, + Set: resourceStepTypesVersionsConfigHash, + ConfigMode: schema.SchemaConfigModeAttr, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "version_number": { - Type: schema.TypeString, - Required: true, + Description: "The semver of the step-type.", + Type: schema.TypeString, + Required: true, }, "step_types_yaml": { + Description: "YAML containing a valid definition of a typed plugin", Type: schema.TypeString, Required: true, ValidateFunc: stringIsYaml, diff --git a/codefresh/resource_team.go b/codefresh/resource_team.go index d5eff329..987b33da 100644 --- a/codefresh/resource_team.go +++ b/codefresh/resource_team.go @@ -2,43 +2,54 @@ package codefresh import ( "fmt" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) func resourceTeam() *schema.Resource { return &schema.Resource{ - Create: resourceTeamCreate, - Read: resourceTeamRead, - Update: resourceTeamUpdate, - Delete: resourceTeamDelete, + Description: "Teams are groups of users that are used to enforce access control.", + Create: resourceTeamCreate, + Read: resourceTeamRead, + Update: resourceTeamUpdate, + Delete: resourceTeamDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, + Description: "The name of the team.", + Type: schema.TypeString, + Required: true, }, "type": { + Description: ` +The type of the team. Possible values: + * __default__ + * __admin__ + `, Type: schema.TypeString, Optional: true, }, "account_id": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Description: "The account id where to create the team.", + Type: schema.TypeString, + Optional: true, + Computed: true, }, "tags": { - Type: schema.TypeSet, - Optional: true, + Description: "The tags of the team.", + Type: schema.TypeSet, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "users": { - Type: schema.TypeSet, - Optional: true, + Description: "A list of user IDs that should be in the team.", + Type: schema.TypeSet, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/codefresh/resource_user.go b/codefresh/resource_user.go index 2fe3706e..d0463f12 100644 --- a/codefresh/resource_user.go +++ b/codefresh/resource_user.go @@ -1,72 +1,85 @@ package codefresh import ( + "log" + cfClient "github.com/codefresh-io/terraform-provider-codefresh/client" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "log" ) func resourceUser() *schema.Resource { return &schema.Resource{ - Create: resourceUsersCreate, - Read: resourceUsersRead, - Update: resourceUsersUpdate, - Delete: resourceUsersDelete, + Description: "This resource is used to manage a Codefresh user.", + Create: resourceUsersCreate, + Read: resourceUsersRead, + Update: resourceUsersUpdate, + Delete: resourceUsersDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ "user_name": { - Type: schema.TypeString, - Required: true, + Description: "The username of the user.", + Type: schema.TypeString, + Required: true, }, "email": { - Type: schema.TypeString, - Required: true, + Description: "The email of the user.", + Type: schema.TypeString, + Required: true, }, "activate": { - Type: schema.TypeBool, - Optional: true, + Description: "Whether to activate the user or to leave it as `pending`.", + Type: schema.TypeBool, + Optional: true, }, "accounts": { - Type: schema.TypeSet, - Required: true, + Description: "A list of accounts IDs to assign the user to.", + Type: schema.TypeSet, + Required: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "personal": { - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: "Personal information about the user.", + Type: schema.TypeList, + Optional: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "first_name": { - Type: schema.TypeString, - Optional: true, + Description: "The first name of the user.", + Type: schema.TypeString, + Optional: true, }, "last_name": { - Type: schema.TypeString, - Optional: true, + Description: "The last name of the user.", + Type: schema.TypeString, + Optional: true, }, "company_name": { - Type: schema.TypeString, - Optional: true, + Description: "The company name of the user.", + Type: schema.TypeString, + Optional: true, }, "phone_number": { - Type: schema.TypeString, - Optional: true, + Description: "The phone number of the user.", + Type: schema.TypeString, + Optional: true, }, "country": { - Type: schema.TypeString, - Optional: true, + Description: "The country of the user.", + Type: schema.TypeString, + Optional: true, }, }, }, }, "short_profile": { - Type: schema.TypeList, - Computed: true, + Description: "The computed short profile of the user.", + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "user_name": { @@ -77,28 +90,33 @@ func resourceUser() *schema.Resource { }, }, "roles": { - Type: schema.TypeSet, - Optional: true, + Description: "The roles of the user.", + Type: schema.TypeSet, + Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "status": { - Type: schema.TypeString, - Computed: true, + Description: "The status of the user (e.g. `new`, `pending`).", + Type: schema.TypeString, + Computed: true, }, "login": { - Type: schema.TypeSet, - Optional: true, + Description: "Login settings for the user.", + Type: schema.TypeSet, + Optional: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "idp_id": { - Type: schema.TypeString, - Optional: true, + Description: "The IdP ID for the user's login.", + Type: schema.TypeString, + Optional: true, }, "sso": { - Type: schema.TypeBool, - Optional: true, + Description: "Whether to enforce SSO for the user.", + Type: schema.TypeBool, + Optional: true, }, }, }, diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 2058b068..00000000 --- a/docs/README.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: "codefresh" -page_title: "Provider: Codefresh" -sidebar_current: "docs-codefresh-index" -description: |- - The Codefresh provider is used to manage Codefresh resources. ---- - -# Codefresh Provider - -The Codefresh Provider can be used to configure [Codefresh](https://codefresh.io/) resources - pipelines, projects, accounts, etc using the [Codefresh API](https://codefresh.io/docs/docs/integrations/codefresh-api/). - -## Authenticating to Codefresh - -The Codefresh API requires the [authentication key](https://codefresh.io/docs/docs/integrations/codefresh-api/#authentication-instructions) to authenticate. -The key can be passed either as provider's attribute or as environment variable - `CODEFRESH_API_KEY`. - -## Argument Reference - -The following arguments are supported: - -- `token` - (Optional) The client API token. This can also be sourced from the `CODEFRESH_API_KEY` environment variable. -- `api_url` -(Optional) Default value - https://g.codefresh.io/api. - -## Recommendation for creation Accounts, Users, Teams, Permissions -* create users and accounts using [accounts_users module](modules/accounts_users.md) and Codefresh Admin token -* Create and save in tf state api_keys using [accounts_token module](modules/account_token.md) -* Create teams using [teams module](modules/teams.md) -* Create permissions - [see example](../examples/permissions) - - -## Resources -* [account](resources/account.md) -* [account-admins](resources/account-admins.md) -* [api-key](resources/api-key.md) -* [context](resources/context.md) -* [idp-accounts](resources/idp-accounts.md) -* [permissions](resources/permissions.md) -* [pipeline](resources/pipeline.md) -* [project](resources/project.md) -* [registry](resources/registry.md) -* [step-types](resources/step-types.md) -* [team](resources/team.md) -* [user](resources/user.md) - - -## Data sources -* [account](data/account.md) -* [context](data/context.md) -* [idps](data/idps.md) -* [registry](data/registry.md) -* [step-types](data/step-types.md) -* [team](data/team.md) -* [user](data/user.md) - diff --git a/docs/data-sources/account.md b/docs/data-sources/account.md new file mode 100644 index 00000000..0b531637 --- /dev/null +++ b/docs/data-sources/account.md @@ -0,0 +1,63 @@ +--- +page_title: "codefresh_account Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source retrieves an account by _id or name. +--- + +# codefresh_account (Data Source) + +This data source retrieves an account by _id or name. + +## Example Usage + +```hcl +data "codefresh_account" "acc" { + name = "acc1" +} + +resource "codefresh_user" "user1" { + email = "user1@example.com" + user_name = "user1" + + accounts = [ + data.codefresh_account.acc.id + ] + + activate = true + + roles = [ + "Admin", + "User" + ] + + login { + idp_id = data.codefresh_idps.idp_azure.id + sso = true + } + + login { + idp_id = data.codefresh_idps.local.id + //sso = false + } + + + personal { + first_name = "John" + last_name = "Smith" + } +} +``` + + +## Schema + +### Optional + +- `_id` (String) +- `admins` (List of String) +- `name` (String) + +### Read-Only + +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/data/context.md b/docs/data-sources/context.md similarity index 67% rename from docs/data/context.md rename to docs/data-sources/context.md index e4d9e573..eed86125 100644 --- a/docs/data/context.md +++ b/docs/data-sources/context.md @@ -1,5 +1,13 @@ -# Data Source: codefresh_context -This data source allows to retrieve information on any defined context +--- +page_title: "codefresh_context Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source allows to retrieve information on any defined context. +--- + +# codefresh_context (Data Source) + +This data source allows to retrieve information on any defined context. ## Example Usage @@ -43,11 +51,15 @@ resource "codefresh_pipeline" "test" { } ``` -## Argument Reference + +## Schema + +### Required -* `name` - (Required) Name of the context to be retrived +- `name` (String) -## Attributes Reference +### Read-Only -* `type` - String identifying the type of extracted context. E.g. `config`, `secret`, `git.github-app`, etc. -* `data` - The yaml string representing the context. Use the `yamldecode` function to access the values belonging the context. +- `data` (String) +- `id` (String) The ID of this resource. +- `type` (String) \ No newline at end of file diff --git a/docs/data-sources/current_account.md b/docs/data-sources/current_account.md new file mode 100644 index 00000000..01dd912f --- /dev/null +++ b/docs/data-sources/current_account.md @@ -0,0 +1,76 @@ +--- +page_title: "codefresh_current_account Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + Returns the current account (owner of the token) and its users. +--- + +# codefresh_current_account (Data Source) + +Returns the current account (owner of the token) and its users. + +## Example Usage + +```hcl +provider "codefresh" { + api_url = var.api_url + token = var.token +} + +data "codefresh_current_account" "acc" { + +} + + +output "current_ac" { + value = data.codefresh_current_account.acc +} +``` + +The output example: +``` +Outputs: + +current_ac = { + "_id" = "5f1fd9044d0fc94ddff0d745" + "id" = "5f1fd9044d0fc94ddff0d745" + "name" = "acc1" + "users" = [ + { + "email" = "kosta@codefresh.io" + "id" = "5f1fd9094d0fc9c656f0d75a" + "name" = "user1" + }, + { + "email" = "kosta@sysadmiral.io" + "id" = "5f1fd9094d0fc93b52f0d75c" + "name" = "user3" + }, + ] +} +``` + + +## Schema + +### Optional + +- `_id` (String) +- `name` (String) +- `users` (Block List) (see [below for nested schema](#nestedblock--users)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `users` + +Required: + +- `email` (String) +- `name` (String) + +Read-Only: + +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/data-sources/idps.md b/docs/data-sources/idps.md new file mode 100644 index 00000000..14ea23c1 --- /dev/null +++ b/docs/data-sources/idps.md @@ -0,0 +1,102 @@ +--- +page_title: "codefresh_idps Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source retrieves all Identity Providers (IdPs) in the system. +--- + +# codefresh_idps (Data Source) + +This data source retrieves all Identity Providers (IdPs) in the system. + +## Example Usage + +``` +data "codefresh_idps" "idp_azure" { + display_name = "codefresh-onprem-tst-2" + # client_name = "2222" + # _id = "5df234543" + client_type = "azure" +} + +data "codefresh_idps" "local" { + display_name = "local" +} + +resource "codefresh_account" "acc" { + name = "acc1" + + features = var.accountFeatures + + limits { + collaborators = 25 + data_retention_weeks = 5 + } + + build { + parallel = 25 + nodes = 7 + } + +} + +resource "codefresh_user" "user1" { + email = "user1@example.com" + user_name = "user1" + + activate = true + + roles = [ + "Admin", + "User" + ] + + login { + idp_id = data.codefresh_idps.idp_azure.id + sso = true + } + + login { + idp_id = data.codefresh_idps.local.id + //sso = false + } + + personal { + first_name = "John" + last_name = "Smith" + } + + accounts = [ + codefresh_account.acc.id + ] +} + +resource "codefresh_idp_accounts" "acc_idp" { + idp_id = data.codefresh_idps.idp_azure.id + account_ids = [codefresh_account.acc.id] +} +``` + + +## Schema + +### Optional + +- `_id` (String) +- `client_name` (String) +- `client_type` (String) +- `display_name` (String) + +### Read-Only + +- `access_token` (String) +- `accounts` (Set of String) +- `app_id` (String) +- `client_host` (String) +- `client_id` (String) +- `client_secret` (String) +- `cookie_iv` (String) +- `cookie_key` (String) +- `id` (String) The ID of this resource. +- `scopes` (Set of String) +- `tenant` (String) \ No newline at end of file diff --git a/docs/data/registry.md b/docs/data-sources/registry.md similarity index 53% rename from docs/data/registry.md rename to docs/data-sources/registry.md index 5782f436..5ef99299 100644 --- a/docs/data/registry.md +++ b/docs/data-sources/registry.md @@ -1,5 +1,13 @@ -# Data Source: codefresh_registry -This data source allows retrieving information on any existing registry +--- +page_title: "codefresh_registry Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source allows retrieving information on any existing registry. +--- + +# codefresh_registry (Data Source) + +This data source allows retrieving information on any existing registry. ## Example Usage @@ -25,15 +33,20 @@ resource "codefresh_registry" "dockerhub1" { } ``` -## Argument Reference + +## Schema + +### Required -* `name` - (Required) Name of the registry to be retrieved +- `name` (String) -## Attributes Reference +### Read-Only -* `domain` - String. -* `registry_provider` - String identifying the type of registry. E.g. `dockerhub, ecr, acr` and others -* `default` - Bool. -* `primary` - Bool. -* `fallback_registry` - String representing the id of the fallback registry. -* `repository prefix` - String representing the optional prefix for registry. +- `default` (Boolean) +- `domain` (String) +- `fallback_registry` (String) +- `id` (String) The ID of this resource. +- `kind` (String) +- `primary` (Boolean) +- `registry_provider` (String) +- `repository_prefix` (String) diff --git a/docs/data-sources/step_types.md b/docs/data-sources/step_types.md new file mode 100644 index 00000000..dcd9691e --- /dev/null +++ b/docs/data-sources/step_types.md @@ -0,0 +1,48 @@ +--- +page_title: "codefresh_step_types Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source allows to retrieve the published versions of step-types. +--- + +# codefresh_step_types (Data Source) + +This data source allows to retrieve the published versions of step-types. + +## Example Usage + +```hcl +data "codefresh_step_types" "freestyle" { + name = "freestyle" +} + +local { + freestyle_map = { for step_definition in data.codefresh_step_types.freestyle.version: step_definition.version_number => step_definition } +} + +output "test" { + # Value is return as YAML + value = local.freestyle_map[keys(local.freestyle_map)[0]].version_number +} + +``` + + +## Schema + +### Required + +- `name` (String) + +### Read-Only + +- `id` (String) The ID of this resource. +- `version` (Set of Object) (see [below for nested schema](#nestedatt--version)) + + +### Nested Schema for `version` + +Read-Only: + +- `step_types_yaml` (String) +- `version_number` (String) \ No newline at end of file diff --git a/docs/data-sources/team.md b/docs/data-sources/team.md new file mode 100644 index 00000000..9091989a --- /dev/null +++ b/docs/data-sources/team.md @@ -0,0 +1,44 @@ +--- +page_title: "codefresh_team Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source retrieves a team by its ID or name. +--- + +# codefresh_team (Data Source) + +This data source retrieves a team by its ID or name. + +## Example Usage + +```hcl +data "codefresh_team" "admin" { + provider = codefresh.acc1 + name = "users" +} + +resource "codefresh_permission" "permission2" { + provider = codefresh.acc1 + team = data.codefresh_team.admin.id + action = "create" + resource = "pipeline" + tags = ["frontend"] +} + +``` + + +## Schema + +### Optional + +- `_id` (String) +- `account_id` (String) +- `name` (String) +- `tags` (List of String) +- `type` (String) +- `users` (List of String) + +### Read-Only + +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/data-sources/user.md b/docs/data-sources/user.md new file mode 100644 index 00000000..127a691f --- /dev/null +++ b/docs/data-sources/user.md @@ -0,0 +1,91 @@ +--- +page_title: "codefresh_user Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source retrieves a user by email. +--- + +# codefresh_user (Data Source) + +This data source retrieves a user by email. + +## Example usage + +```hcl +data "codefresh_user" "admin" { + email = "admin@codefresh.io" +} + +resource "codefresh_team" "admins" { + + name = "testsuperteam123" + + users = [ + data.codefresh_user.admin.user_id, + "", + ] +} +``` + + +## Schema + +### Required + +- `email` (String) + +### Read-Only + +- `id` (String) The ID of this resource. +- `logins` (List of Object) (see [below for nested schema](#nestedatt--logins)) +- `personal` (List of Object) (see [below for nested schema](#nestedatt--personal)) +- `roles` (Set of String) +- `short_profile` (List of Object) (see [below for nested schema](#nestedatt--short_profile)) +- `status` (String) +- `user_id` (String) +- `user_name` (String) + + +### Nested Schema for `logins` + +Read-Only: + +- `credentials` (List of Object) (see [below for nested schema](#nestedobjatt--logins--credentials)) +- `idp` (List of Object) (see [below for nested schema](#nestedobjatt--logins--idp)) + + +### Nested Schema for `logins.credentials` + +Read-Only: + +- `permissions` (Set of String) + + + +### Nested Schema for `logins.idp` + +Read-Only: + +- `client_type` (String) +- `id` (String) + + + + +### Nested Schema for `personal` + +Read-Only: + +- `company_name` (String) +- `country` (String) +- `first_name` (String) +- `last_name` (String) +- `phone_number` (String) + + + +### Nested Schema for `short_profile` + +Read-Only: + +- `user_name` (String) \ No newline at end of file diff --git a/docs/data-sources/users.md b/docs/data-sources/users.md new file mode 100644 index 00000000..4f28c6fe --- /dev/null +++ b/docs/data-sources/users.md @@ -0,0 +1,84 @@ +--- +page_title: "codefresh_users Data Source - terraform-provider-codefresh" +subcategory: "" +description: |- + This data source retrieves all users in the system. +--- + +# codefresh_users (Data Source) + +This data source retrieves all users in the system. + +## Example usage + +```hcl +data "codefresh_users" "users" {} +} +``` + + +## Schema + +### Read-Only + +- `id` (String) The ID of this resource. +- `users` (List of Object) (see [below for nested schema](#nestedatt--users)) + + +### Nested Schema for `users` + +Read-Only: + +- `email` (String) +- `logins` (List of Object) (see [below for nested schema](#nestedobjatt--users--logins)) +- `personal` (List of Object) (see [below for nested schema](#nestedobjatt--users--personal)) +- `roles` (Set of String) +- `short_profile` (List of Object) (see [below for nested schema](#nestedobjatt--users--short_profile)) +- `status` (String) +- `user_id` (String) +- `user_name` (String) + + +### Nested Schema for `users.logins` + +Read-Only: + +- `credentials` (List of Object) (see [below for nested schema](#nestedobjatt--users--logins--credentials)) +- `idp` (List of Object) (see [below for nested schema](#nestedobjatt--users--logins--idp)) + + +### Nested Schema for `users.logins.credentials` + +Read-Only: + +- `permissions` (Set of String) + + + +### Nested Schema for `users.logins.idp` + +Read-Only: + +- `client_type` (String) +- `id` (String) + + + + +### Nested Schema for `users.personal` + +Read-Only: + +- `company_name` (String) +- `country` (String) +- `first_name` (String) +- `last_name` (String) +- `phone_number` (String) + + + +### Nested Schema for `users.short_profile` + +Read-Only: + +- `user_name` (String) \ No newline at end of file diff --git a/docs/data/step-types.md b/docs/data/step-types.md deleted file mode 100644 index cedfe655..00000000 --- a/docs/data/step-types.md +++ /dev/null @@ -1,34 +0,0 @@ -# Data Source: codefresh_step_types -This data source allows to retrieve the published versions of a step-types - -## Example Usage - -```hcl -data "codefresh_step_types" "freestyle" { - name = "freestyle" -} - -local { - freestyle_map = { for step_definition in data.codefresh_step_types.freestyle.version: step_definition.version_number => step_definition } -} - -output "test" { - # Value is return as YAML - value = local.freestyle_map[keys(local.freestyle_map)[0]].version_number -} - -``` - -## Argument Reference - -* `name` - (Required) Name of the step-types to be retrieved - -## Attributes Reference - -- `version` - A Set of `version` blocks as documented below. - ---- - -`version` provides the following: -- `version_number` - String representing the semVer for the step -- `step_types_yaml` - YAML String containing the definition of a typed plugin diff --git a/docs/data/team.md b/docs/data/team.md deleted file mode 100644 index b1c3f7de..00000000 --- a/docs/data/team.md +++ /dev/null @@ -1,20 +0,0 @@ -# data codefresh_team - -*Note*: Teams resources should be called with account specific access token - -``` -data "codefresh_team" "admin" { - provider = codefresh.acc1 - name = "users" -} - -resource "codefresh_permission" "permission2" { - provider = codefresh.acc1 - team = data.codefresh_team.admin.id - action = "create" - resource = "pipeline" - tags = ["frontend"] -} - -``` - diff --git a/docs/data/user.md b/docs/data/user.md deleted file mode 100644 index 2f1d2ef6..00000000 --- a/docs/data/user.md +++ /dev/null @@ -1,59 +0,0 @@ -# User Data Source - -Use this data source to get the User from existing users for use in other resources. - -## Example usage - -```hcl -data "codefresh_user" "admin" { - email = "admin@codefresh.io" -} - -resource "codefresh_team" "admins" { - - name = "testsuperteam123" - - users = [ - data.codefresh_user.admin.user_id, - "", - ] -} -``` - -## Argument Reference - -- `email` - (Required) The email of user to filter. - -## Attributes Reference - -- `user_name`. -- `email`. -- `user_id`. -- `personal`. A collection of `personal` blocks as documented below. -- `short_profile`. A collection of `short_profile` blocks as documented below. -- `roles`. A list of roles. -- `status`. User status - `new`, `pending`, etc. -- `logins`. A collection of `short_profile` blocks as documented below. - ---- - -`personal` includes the following: -- `first_name`. -- `last_name`. -- `company_name`. -- `phone_number`. -- `country`. - ---- - -`short_profile` includes the following: -- `user_name`. - ---- - -`logins` includes the following: -- `credentials` - - `permissions` -- `idp` - - `id` - - `client_type \ No newline at end of file diff --git a/docs/data/users.md b/docs/data/users.md deleted file mode 100644 index 30e39257..00000000 --- a/docs/data/users.md +++ /dev/null @@ -1,14 +0,0 @@ -`# Users Data Source - -Use this data source to get all existing users from Codefresh. - -## Example usage - -```hcl -data "codefresh_users" "users" {} -} -``` - -## Attributes Reference - -- `users` - A list of [user](./user.md) \ No newline at end of file diff --git a/docs/developer.md b/docs/developer.md deleted file mode 100644 index 63c39315..00000000 --- a/docs/developer.md +++ /dev/null @@ -1,38 +0,0 @@ -## Developer guide - -We are using [Terraform Plugin SDK v2](https://github.com/hashicorp/terraform-plugin-sdk/tree/v2.0.0-rc.2) - -### Run with Delve Debugger -[Reference guide](https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#support-for-debuggable-provider-binaries) -[sdk code](https://github.com/hashicorp/terraform-plugin-sdk/blob/v2.0.0-rc.2/plugin/debug.go#L97) - -run pluging with set env CODEFRESH_PLUGIN_DEBUG=true in delve -- for vscode set launch.json like this: -```json -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.1", - "configurations": [ - { - "name": "terraform-provider-codefresh", - "type": "go", - "request": "launch", - "mode": "debug", - "port": 2345, - "host": "127.0.0.1", - "env": {"CODEFRESH_PLUGIN_DEBUG": "true"}, - "program": "/d1/home/kosta/devel/go/src/github.com/codefresh-io/terraform-provider-codefresh/main.go", - "showLog": true, - "trace": "verbose" - } - ] -} -``` -- copy value of TF_REATTACH_PROVIDERS from the output of debug console and set it for terraform exec: -``` -export TF_REATTACH_PROVIDERS='{"registry.terraform.io/-/codefresh":{"Protocol":"grpc","Pid":614875,"Test":true,"Addr":{"Network":"unix","String":"/tmp/plugin369955425"}}}' - -terraform apply -``` diff --git a/docs/guides/development.md b/docs/guides/development.md new file mode 100644 index 00000000..530c3f35 --- /dev/null +++ b/docs/guides/development.md @@ -0,0 +1,71 @@ +## Development + +We are currently using [Terraform Plugin SDK v2](https://github.com/hashicorp/terraform-plugin-sdk). + +It is possible that we will switch to the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework) sometime in the future. + +### Prerequisites (other than Terraform) + +- GNU Make +- [Go](https://golang.org/doc/install) `1.18.x+` (minimum supported Go version required to build the provider). + +### Building and Running a Local Build of the Provider + +```bash +make install +``` + +Set the [developer overrides](https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers) to point Terraform at the locally-built binary: + +```terraform +# `~/.terraformrc (Windows: %APPDATA%/.terraformrc) +provider_installation { + dev_overrides { + "codefresh.io/codefresh" = "[REPLACE WITH GOPATH]/bin" + } + direct {} +} +``` + +Note that if developer overrides are set, Terraform will ignore the version pinned in `versions.tf`, so you do not need to remove the version pin when testing. You can keep it. + +### Debugging with Delve + +[Reference guide](https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#support-for-debuggable-provider-binaries) + +[SDK code](https://github.com/hashicorp/terraform-plugin-sdk/blob/v2.0.0-rc.2/plugin/debug.go#L97) + +Run the provider with `CODEFRESH_PLUGIN_DEBUG=true` in Delve debugger. + +For vscode, set `launch.json` as follows: + +```json +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.1", + "configurations": [ + { + "name": "terraform-provider-codefresh", + "type": "go", + "request": "launch", + "mode": "debug", + "port": 2345, + "host": "127.0.0.1", + "env": {"CODEFRESH_PLUGIN_DEBUG": "true"}, + "program": "/home/mitchellh/go/src/github.com/codefresh-io/terraform-provider-codefresh/main.go", + "showLog": true, + "trace": "verbose" + } + ] +} +``` + +Then, copy the value of `TF_REATTACH_PROVIDERS` from the output of debug console and set it for terraform exec: + +```bash +export TF_REATTACH_PROVIDERS='{"registry.terraform.io/-/codefresh":{"Protocol":"grpc","Pid":614875,"Test":true,"Addr":{"Network":"unix","String":"/tmp/plugin369955425"}}}' + +terraform apply +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..bc9a84f1 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,52 @@ +--- +layout: "codefresh" +page_title: "Provider: Codefresh" +sidebar_current: "docs-codefresh-index" +description: |- + The Codefresh provider is used to manage Codefresh resources. +--- + +# Codefresh Provider + +The Codefresh Provider can be used to configure [Codefresh](https://codefresh.io/) resources - pipelines, projects, accounts, etc using the [Codefresh API](https://codefresh.io/docs/docs/integrations/codefresh-api/). + +## Authenticating to Codefresh + +The Codefresh API requires the [authentication key](https://codefresh.io/docs/docs/integrations/codefresh-api/#authentication-instructions) to authenticate. +The key can be passed either as the provider's attribute or as environment variable - `CODEFRESH_API_KEY`. + + +## Schema + +### Optional + +- `api_url` (String) The Codefresh API URL. Defaults to `https://g.codefresh.io/api`. Can also be set using the `CODEFRESH_API_URL` environment variable. +- `token` (String) The Codefresh API token. Can also be set using the `CODEFRESH_API_KEY` environment variable. + +## Managing Resources Across Different Accounts + +The Codefresh API only allows one to operate with the entities in the account tied to the API Key the provider is configured for. + +To be able to operate with entities in different accounts, you should create a new key in the relevant account and use providers [aliases](https://www.terraform.io/docs/configuration/providers.html#alias-multiple-provider-instances). + +For example: + +```hcl +provider "codefresh" { + api_key = "..." +} + +provider "codefresh" { + api_key = "..." + alias = "acme-dev" +} + +resource "codefresh_pipeline" "pipeline" { + ... # Omited for brevity +} + +resource "codefresh_pipeline" "pipeline-dev" { + provider = codefresh.acme-dev + ... # Omited for brevity +} +``` \ No newline at end of file diff --git a/docs/modules/account_token.md b/docs/modules/account_token.md deleted file mode 100644 index 332de346..00000000 --- a/docs/modules/account_token.md +++ /dev/null @@ -1,51 +0,0 @@ -# modules account_token and account_tokens - -To operate with Teams and Permission we should use token generated for Codefresh Account user (not adminCF token) - - -[account_token](../../tf_modules/account_token) - creates and outputs token of single account, for usage in aliased providers - -[account_tokens](../../tf_modules/account_tokens) - creates and outputs token for multiple accounts, for usage in other per-account configurations - -### Example - account_token -```hcl -module "account_token" "acc1_token" { - source = "../../tf_modules/account_token" - account_name = "acc1" -} - -provider "codefresh" { - alias = "acc1" - api_url = var.api_url - token = module.change_account.acc1_token.token -} - -resource "codefresh_team" "developers" { - provider = codefresh.acc1 - name = "developers" - account_id = data.codefresh_account.acc.id - - users = [ - data.codefresh_user.user.id - ] -} - -resource "codefresh_permission" "permission" { - for_each = toset(["run", "create", "update", "delete", "read", "approve"]) - provider = codefresh.acc1 - team = codefresh_team.developers.id - action = each.value - resource = "pipeline" - tags = [ "*", "untagged"] -} - -``` - -### [Example account-tokens](../../examples/account_tokens) -Output example: -``` - "account_tokens": { - "acc1": "1xxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1", - "acc2": "2xxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2" - } -``` \ No newline at end of file diff --git a/docs/modules/accounts_users.md b/docs/modules/accounts_users.md deleted file mode 100644 index e1968e3d..00000000 --- a/docs/modules/accounts_users.md +++ /dev/null @@ -1,4 +0,0 @@ -# module account_users - -[accounts_users source](../../tf_modules/accounts_users) -[accounts_users example](../../examples/accounts_users) diff --git a/docs/modules/teams.md b/docs/modules/teams.md deleted file mode 100644 index 6f515693..00000000 --- a/docs/modules/teams.md +++ /dev/null @@ -1,4 +0,0 @@ -# module teams - -[teams source](../../tf_modules/teams) -[teams example](../../examples/teams) \ No newline at end of file diff --git a/docs/resources/account.md b/docs/resources/account.md index 6da85eb0..e0e27dad 100644 --- a/docs/resources/account.md +++ b/docs/resources/account.md @@ -1,7 +1,15 @@ -# Account resource +--- +page_title: "codefresh_account Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + By creating different accounts for different teams within the same company a customer can achieve complete segregation of assets between the teams. +--- + +# codefresh_account (Resource) By creating different accounts for different teams within the same company a customer can achieve complete segregation of assets between the teams. -See the [documentation](https://codefresh.io/docs/docs/administration/ent-account-mng/). + +See the [documentation](https://codefresh.io/docs/docs/administration/account-user-management/). ## Example usage @@ -29,30 +37,53 @@ resource "codefresh_account" "test" { } ``` -## Argument Reference + +## Schema -- `name` - (Required) The display name for the account. -- `limits` - (Optional) A collection of `limits` blocks as documented below. -- `build` - (Optional) A collection of `build` blocks as documented below. -- `features` - (Optional) map of supported features toggles ---- +### Required -`limits` supports the following: -- `collaborators` - (Optional) Max account's collaborators number. -- `data_retention_weeks` -(Optional) How long in weeks will the builds be stored. +- `name` (String) The display name for the account. ---- +### Optional -`build` supports the following: -- `parallel` - (Optional) How many pipelines can be run in parallel. -` `node` - (Optional) Number of nodes. +- `build` (Block List) Build limits for this account. (see [below for nested schema](#nestedblock--build)) +- `features` (Map of Boolean) Features toggles for this account. Default: -## Attributes Reference +OfflineLogging: true +ssoManagement: true +teamsManagement: true +abac: true +customKubernetesCluster: true +- `limits` (Block List) Limits for this account. (see [below for nested schema](#nestedblock--limits)) -- `id` - The Account ID. +### Read-Only -## Import +- `id` (String) The ID of this resource. + + +### Nested Schema for `build` + +Required: + +- `parallel` (Number) The number of parallel builds allowed for this account. +Optional: + +- `nodes` (Number) The number of nodes allowed for this account (default: `1`). + + + +### Nested Schema for `limits` + +Required: + +- `collaborators` (Number) The number of collaborators allowed for this account. + +Optional: + +- `data_retention_weeks` (Number) Specifies how long, in weeks, the builds be stored (default: `5`). + +## Import ```sh terraform import codefresh_account.test xxxxxxxxxxxxxxxxxxx -``` +``` \ No newline at end of file diff --git a/docs/resources/account_admins.md b/docs/resources/account_admins.md new file mode 100644 index 00000000..4fd0910c --- /dev/null +++ b/docs/resources/account_admins.md @@ -0,0 +1,75 @@ +--- +page_title: "codefresh_account_admins Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + Use this resource to set a list of admins for any account. +--- + +# codefresh_account_admins (Resource) + +Use this resource to set a list of admins for any account. + +## Example usage + +#### Example 1 + +```hcl +resource "codefresh_account_admins" "test" { + + account_id = + + users = [ + , + ] +} +``` + +#### Example 2 + +```hcl +resource "codefresh_account" "test" { + + name = "mynewaccount" + + limits { + collaborators = 25 + data_retention_weeks = 5 + } + + build { + parallel = 2 + } + +} + +data "codefresh_user" "admin" { + email = "" +} + +resource "codefresh_account_admins" "test" { + + account_id = codefresh_account.test.id + + users = [ + data.codefresh_user.admin.user_id + ] +} +``` + + +## Schema + +### Required + +- `account_id` (String) The account id where to set up a list of admins. +- `users` (Set of String) A list of users to set up as account admins. + +### Read-Only + +- `id` (String) The ID of this resource. + +## Import + +```sh +terraform import codefresh_account_admins.test xxxxxxxxxxxxxxxxxxx +``` \ No newline at end of file diff --git a/docs/resources/api-key.md b/docs/resources/api-key.md deleted file mode 100644 index 75d314d2..00000000 --- a/docs/resources/api-key.md +++ /dev/null @@ -1,94 +0,0 @@ -# API Key resource - -By default **terraform-provider-codefresh** uses API key, passed as provider's attribute, but it's possible to generate a new one. -Codefresh API allows to operate only with entities in the current account, which owns the provided API Key. -To be able to operate with entities in different accounts - you should create a new key in the relevant account and use providers [alias](https://www.terraform.io/docs/configuration/providers.html#alias-multiple-provider-instances). - -## Example usage - -```hcl -provider "codefresh" { - api_url = "my API URL" - token = "my init API token" -} - -resource "codefresh_account" "test" { - name = "my new account" -} - -resource "random_string" "random" { - length = 16 - special = false -} - -resource "codefresh_api_key" "new" { - account_id = codefresh_account.test.id - user_id = data.codefresh_account.test_account_user.user_id - name = "tfkey_${random_string.random.result}" - - scopes = [ - "agent", - "agents", - "audit", - "build", - "cluster", - "clusters", - "environments-v2", - "github-action", - "helm", - "kubernetes", - "pipeline", - "project", - "repos", - "runner-installation", - "step-type", - "step-types", - "view", - "workflow", - ] -} - -provider "codefresh" { - alias = "new_account" - api_url = "my API URL" - token = codefresh_api_key.new.token -} - - -resource "codefresh_team" "team_1" { - - provider = codefresh.new_account - - name = "team name" -} -``` - -## Argument Reference - -- `name` - (Required) The display name for the API key. -- `account_id` - (Required) The ID of account in which the API key will be created. -- `user_id` - (Required) The ID of a user within the referenced `account_id` that will own the API key. -- `scopes` - (Optional) A list of access scopes, that can be targeted. The possible values: - - `agent` - - `agents` - - `audit` - - `build` - - `cluster` - - `clusters` - - `environments-v2` - - `github-action` - - `helm` - - `kubernetes` - - `pipeline` - - `project` - - `repos` - - `runner-installation` - - `step-type` - - `step-types` - - `view` - - `workflow` - -## Attributes Reference - -- `id` - The Key ID. -- `token` - The Token, that should used as a new provider's token attribute. diff --git a/docs/resources/api_key.md b/docs/resources/api_key.md new file mode 100644 index 00000000..057a3853 --- /dev/null +++ b/docs/resources/api_key.md @@ -0,0 +1,109 @@ +--- +page_title: "codefresh_api_key Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + Manages an API Key tied to an Account and a User. +--- + +# codefresh_api_key (Resource) + +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. + + + +## Example usage + +```hcl +provider "codefresh" { + api_url = "my API URL" + token = "my init API token" +} + +resource "codefresh_account" "test" { + name = "my new account" +} + +resource "random_string" "random" { + length = 16 + special = false +} + +resource "codefresh_api_key" "new" { + account_id = codefresh_account.test.id + user_id = data.codefresh_account.test_account_user.user_id + name = "tfkey_${random_string.random.result}" + + scopes = [ + "agent", + "agents", + "audit", + "build", + "cluster", + "clusters", + "environments-v2", + "github-action", + "helm", + "kubernetes", + "pipeline", + "project", + "repos", + "runner-installation", + "step-type", + "step-types", + "view", + "workflow", + ] +} + +provider "codefresh" { + alias = "new_account" + api_url = "my API URL" + token = codefresh_api_key.new.token +} + + +resource "codefresh_team" "team_1" { + + provider = codefresh.new_account + + name = "team name" +} +``` + + +## Schema + +### Required + +- `account_id` (String) The ID of account in which the API key will be created. +- `name` (String) The display name for the API key. +- `user_id` (String) The ID of a user within the referenced `account_id` that will own the API key. + +### Optional + +- `scopes` (Set of String) A list of access scopes for the API key. The possible values: + * agent + * agents + * audit + * build + * cluster + * clusters + * environments-v2 + * github-action + * helm + * kubernetes + * pipeline + * project + * repos + * runner-installation + * step-type + * step-types + * view + * workflow + +### Read-Only + +- `id` (String) The ID of this resource. +- `token` (String, Sensitive) The resulting API key. \ No newline at end of file diff --git a/docs/resources/context.md b/docs/resources/context.md index 4efb6399..9fb4b290 100644 --- a/docs/resources/context.md +++ b/docs/resources/context.md @@ -1,23 +1,38 @@ -# Context Resource -A Context is an authentication/configuration that is used by Codefresh system and engine. +--- +page_title: "codefresh_context Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + A Context is an authentication/configuration that is used by the Codefresh system and engine. +--- + +# codefresh_context (Resource) + +A Context is an authentication/configuration that is used by the Codefresh system and engine. + +## Supported types + There are multiple types of context available in Codefresh but they all have the following main components to define them: -* Name: A unique identifier for the context -* Type: A string representing the type of context -* Data: A data structure that provide the information related to the Context. This differs based on the type of context selected + +* `Name`: A unique identifier for the context +* `Type`: A string representing the type of context +* `Data`: A data structure that provide the information related to the Context. This differs based on the type of context selected For more details of the Context spec see in the [CLI official documentation](https://codefresh-io.github.io/cli/contexts/spec/) -## Supported types -Currently the provider support the following types of Context: -* config (Shared Config ) -* secret (Shared Secret) -* yaml (YAML Configuration Context) -* secret-yaml (Secret YAML Configuration Context) +Currently the provider supports the following types of Context: + +* `config` (Shared Config) +* `secret` (Shared Secret) +* `yaml` (YAML Configuration Context) +* `secret-yaml` (Secret YAML Configuration Context) ### Shared Configuration A Shared Configuration is the entity in Codefresh that allow to create values in a central place that can then be consumed in pipelines to keep them DRY. More details in the official [Shared Configuration documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/) -#### Example Usage of config (Shared Config) +### Example Usage + +#### Shared Config + ```hcl resource "codefresh_context" "test-config" { name = "my-shared-config" @@ -32,7 +47,8 @@ resource "codefresh_context" "test-config" { } ``` -#### Example Usage of secret (Shared Secret) +#### Shared Secret + ```hcl resource "codefresh_context" "test-secret" { name = "my-shared-secret" @@ -47,7 +63,8 @@ resource "codefresh_context" "test-secret" { } ``` -#### Example Usage of yaml (YAML Configuration Context) +#### YAML Configuration Context + ```hcl resource "codefresh_context" "test-yaml" { name = "my-shared-yaml" @@ -65,7 +82,8 @@ YAML } ``` -#### Example Usage of secret-yaml (Secret YAML Configuration Context) +#### Secret YAML Configuration Context + ```hcl resource "codefresh_context" "test-secret-yaml" { name = "my-shared-secret-yaml" @@ -77,43 +95,134 @@ resource "codefresh_context" "test-secret-yaml" { } ``` + +## Schema -## Argument Reference +### Required -- `name` - (Required) The display name for the context. -- `spec` - (Required) A `spec` block as documented below. +- `name` (String) The display name for the context. +- `spec` (Block List, Min: 1, Max: 1) The context's specs. (see [below for nested schema](#nestedblock--spec)) ---- +### Read-Only -`spec` supports the following (Note: only 1 of the below can be specified at any time): +- `id` (String) The ID of this resource. -- `config` - (Optional) A `config` block as documented below. Shared Config [spec](https://codefresh-io.github.io/cli/contexts/spec/config/). -- `secret` - (Optional) A `secret` block as documented below. Shared Secret [spec](https://codefresh-io.github.io/cli/contexts/spec/secret/). -- `yaml` - (Optional) A `yaml` block as documented below. Yaml Configuration Context [spec](https://codefresh-io.github.io/cli/contexts/spec/yaml/). -- `secretyaml` - (Optional) A `secretyaml` block as documented below. Secret Yaml Configuration Context[spec](https://codefresh-io.github.io/cli/contexts/spec/secret-yaml/). + +### Nested Schema for `spec` ---- +Optional: -`config` supports the following: +- `config` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--config)) +- `secret` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--secret)) +- `secretyaml` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--secretyaml)) +- `storageazuref` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--storageazuref)) +- `storagegc` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--storagegc)) +- `storages3` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--storages3)) +- `yaml` (Block List, Max: 1) (see [below for nested schema](#nestedblock--spec--yaml)) -- `data` - (Required) Map of strings representing the variables to be defined in the Shared Config. + +### Nested Schema for `spec.config` ---- +Required: -`secret` supports the following: +- `data` (Map of String) The map of variables representing the shared config. -- `data` - (Required) Map of strings representing the variables to be defined in the Shared Config. ---- + +### Nested Schema for `spec.secret` + +Required: + +- `data` (Map of String, Sensitive) The map of variables representing the shared config (secret). + + + +### Nested Schema for `spec.secretyaml` + +Required: + +- `data` (String, Sensitive) The YAML string representing the shared config (secret). + + + +### Nested Schema for `spec.storageazuref` + +Required: + +- `data` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--spec--storageazuref--data)) + + +### Nested Schema for `spec.storageazuref.data` + +Required: + +- `auth` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--spec--storageazuref--data--auth)) + + +### Nested Schema for `spec.storageazuref.data.auth` + +Required: + +- `account_key` (String) +- `account_name` (String) +- `type` (String) + + + + + +### Nested Schema for `spec.storagegc` + +Required: + +- `data` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--spec--storagegc--data)) + + +### Nested Schema for `spec.storagegc.data` + +Required: + +- `auth` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--spec--storagegc--data--auth)) + + +### Nested Schema for `spec.storagegc.data.auth` + +Required: + +- `json_config` (Map of String) +- `type` (String) + + + + + +### Nested Schema for `spec.storages3` + +Required: + +- `data` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--spec--storages3--data)) + + +### Nested Schema for `spec.storages3.data` + +Required: + +- `auth` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--spec--storages3--data--auth)) + + +### Nested Schema for `spec.storages3.data.auth` + +Required: + +- `json_config` (Map of String) +- `type` (String) -`yaml` supports the following: -- `data` - (Required) String representing a YAML file content ---- -`secretyaml` supports the following: + +### Nested Schema for `spec.yaml` -- `data` - (Required) String representing a YAML file content +Required: ---- \ No newline at end of file +- `data` (String) The YAML string representing the shared config. \ No newline at end of file diff --git a/docs/resources/idp_accounts.md b/docs/resources/idp_accounts.md new file mode 100644 index 00000000..7a588649 --- /dev/null +++ b/docs/resources/idp_accounts.md @@ -0,0 +1,47 @@ +--- +page_title: "codefresh_idp_accounts Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + This resource adds the list of provided account IDs to the IDP.Because of the current Codefresh API limitation it's impossible to remove account from IDP, thus deletion is not supported. +--- + +# codefresh_idp_accounts (Resource) + +This resource adds the list of provided account IDs to the IDP. +Because of the current Codefresh API limitation it's impossible to remove account from IDP, thus deletion is not supported. + +## Example usage + +```hcl +resource "codefresh_account" "test" { + name = "" +} + +resource "codefresh_idp_accounts" "test" { + + idp = "azure" + + accounts = [ + codefresh_account.test.id, + "" + ] +} +``` + + +## Schema + +### Required + +- `account_ids` (Set of String) A list of account IDs to add to the IdP. +- `idp_id` (String) The IdP name. + +### Read-Only + +- `id` (String) The ID of this resource. + +## Import + +```sh +terraform import codefresh_idp_accounts.test xxxxxxxxxxxxxxxxxxx +``` diff --git a/docs/resources/permission.md b/docs/resources/permission.md new file mode 100644 index 00000000..215a720a --- /dev/null +++ b/docs/resources/permission.md @@ -0,0 +1,65 @@ +--- +page_title: "codefresh_permission Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + Permission are used to setup access control and allow to define which teams have access to which clusters and pipelines based on tags. +--- + +# codefresh_permission (Resource) + +Permission are used to setup access control and allow to define which teams have access to which clusters and pipelines based on tags. + +See the [Access Control documentation](https://codefresh.io/docs/docs/administration/account-user-management/access-control/). + +## Example usage + +```hcl +resource "codefresh_team" "developers" { + name = "developers" + + users = [ + "5efc3cb6355c6647041b6e49", + "59009221c102763beda7cf04" + ] +} + +resource "codefresh_permission" "developers" { + + team = codefresh_team.developers.id + resource = "pipeline" + action = "run" + tags = [ + "demo", + "test" + ] +} +``` + + +## Schema + +### Required + +- `action` (String) Action to be allowed. Possible values: + * create + * read + * update + * delete + * run (Only valid for pipeline resource) + * approve (Only valid for pipeline resource) + * debug (Only valid for pipeline resource) +- `resource` (String) The type of resources the permission applies to. Possible values: + * pipeline + * cluster +- `team` (String) The Id of the team the permissions apply to. + +### Optional + +- `_id` (String) The permission ID. +- `tags` (Set of String) The effective tags to apply the permission. It supports 2 custom tags: + * untagged is a “tag” which refers to all clusters that don't have any tag. + * (the star character) means all tags. + +### Read-Only + +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/permissions.md b/docs/resources/permissions.md deleted file mode 100644 index 82cf66cf..00000000 --- a/docs/resources/permissions.md +++ /dev/null @@ -1,49 +0,0 @@ -# resource codefresh_permission -Permission are used to setup access control and allow to define which teams have access to which clusters and pipelines based on tags -See the [documentation](https://codefresh.io/docs/docs/administration/access-control/). - -## Example usage - -```hcl -resource "codefresh_team" "developers" { - name = "developers" - - users = [ - "5efc3cb6355c6647041b6e49", - "59009221c102763beda7cf04" - ] -} - -resource "codefresh_permission" "developers" { - - team = codefresh_team.developers.id - resource = "pipeline" - action = "run" - tags = [ - "demo", - "test" - ] -} -``` - -## Argument Reference - -- `action` - (Required) Action to be allowed. Possible values: - - __create__ - - __read__ - - __update__ - - __delete__ - - __run__ (Only valid for `pipeline` resource) - - __approve__ (Only valid for `pipeline` resource) - - __debug__ (Only valid for `pipeline` resource) -- `resource` - (Required) The type of resource the permission applies to. Possible values: - - __pipeline__ - - __cluster__ -- `team` - (Required) The Id of the team the permissions apply to. -- `tags` - (Optional) The effective tags to apply the permission. It supports 2 custom tags: - - __untagged__ is a “tag” which refers to all clusters that don’t have any tag. - - __*__ (the star character) means all tags. - -## Attributes Reference - -- `id` - The permission ID. diff --git a/docs/resources/pipeline.md b/docs/resources/pipeline.md index c58c318c..221d679e 100644 --- a/docs/resources/pipeline.md +++ b/docs/resources/pipeline.md @@ -1,6 +1,14 @@ -# Pipeline Resource +--- +page_title: "codefresh_pipeline Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + The central component of the Codefresh Platform. Pipelines are workflows that contain individual steps. Each step is responsible for a specific action in the process. +--- + +# codefresh_pipeline (Resource) The central component of the Codefresh Platform. Pipelines are workflows that contain individual steps. Each step is responsible for a specific action in the process. + See the [documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/introduction-to-codefresh-pipelines/) for the details. ## Example Usage @@ -83,102 +91,99 @@ resource "codefresh_pipeline" "test" { } ``` -## Argument Reference + +## Schema -- `name` - (Required) The display name for the pipeline. -- `revision` - (Optional) The pipeline's revision. Should be added to the **lifecycle/ignore_changes** or incremented mannually each update. -- `is_public` - (Optional) Boolean that specifies if the build logs are publicly accessible. Default: false -- `tags` - (Optional) A list of tags to mark a project for easy management and access control. -- `spec` - (Required) A collection of `spec` blocks as documented below. -- `original_yaml_string` - (Optional) A string with original yaml pipeline. - - `original_yaml_string = "version: \"1.0\"\nsteps:\n test:\n image: alpine:latest\n commands:\n - echo \"ACC tests\""` - - or `original_yaml_string = file("/path/to/my/codefresh.yml")` +### Required ---- +- `name` (String) The display name for the pipeline. -`spec` supports the following: - -- `concurrency` - (Optional) The maximum amount of concurrent builds. -- `branch_concurrency` - (Optional) The maximum amount of concurrent builds that may run for each branch -- `trigger_concurrency` - (Optional) The maximum amount of concurrent builds that may run for each trigger. -- `priority` - (optional) Helps to organize the order of builds execution in case of reaching the concurrency limit. -- `variables` - (Optional) Pipeline variables. -- `trigger` - (Optional) A collection of `trigger` blocks as documented below. Triggers [documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/triggers/git-triggers/). -- `spec_template` - (Optional) A collection of `spec_template` blocks as documented below. -- `runtime_environment` - (Optional) A collection of `runtime_environment` blocks as documented below. -- `pack_id` - (Optional) SAAS pack (`5cd1746617313f468d669013` for Small; `5cd1746717313f468d669014` for Medium; `5cd1746817313f468d669015` for Large; `5cd1746817313f468d669017` for XL; `5cd1746817313f468d669018` for XXL) -- `required_available_storage` - (Optional) Minimum disk space required for build filesystem ( unit Gi is required) -- `contexts` - (Optional) A list of strings representing the contexts ([shared_configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)) to be configured for the pipeline -- `termination_policy` - (Optional) A `termination_policy` block as documented below. -- `options` - (Optional) A `options` block as documented below. +### Optional ---- +- `is_public` (Boolean) Boolean that specifies if the build logs are publicly accessible (default: `false`). +- `original_yaml_string` (String) A string with original yaml pipeline. -`spec_template` supports the following: +For example: -- `location` - (Optional) Default value - **git**. -- `repo` - (Required) The GitHub `account/repo_name`. -- `path` - (Required) The relative path to the Codefresh pipeline file. -- `revison` - (Required) The git revision. -- `context` - (Optional) The Codefresh Git [context](https://codefresh.io/docs/docs/integrations/git-providers/). +original_yaml_string = "version: \\"1.0\\"\nsteps:\n test:\n image: alpine:latest\n commands:\n - echo \\"ACC tests\\" ---- +Or: original_yaml_string = file("/path/to/my/codefresh.yml") +- `spec` (Block List, Max: 1) The pipeline's specs. (see [below for nested schema](#nestedblock--spec)) +- `tags` (Set of String) A list of tags to mark a project for easy management and access control. -`trigger` supports the following: - -- `name` - (Optional) The display name for the pipeline. -- `description` - (Optional) The trigger description. -- `type` - (Optional) The trigger type. Default value - **git**. -- `repo` - (Optional) The GitHub `account/repo_name`. -- `branch_regex` - (Optional) A regular expression and will only trigger for branches that match this naming pattern. -- `branch_regex_input` - (Optional) Flag to manage how the `branch_regex` field is interpreted. Possible values: "multiselect-exclude", "multiselect", "regex". Default: "regex" -- `pull_request_target_branch_regex` - (Optional) A regular expression and will only trigger for pull requests to branches that match this naming pattern. -- `comment_regex` - (Optional) A regular expression and will only trigger for pull requests where a comment matches this naming pattern. -- `modified_files_glob` - (Optional) Allows to constrain the build and trigger it only if the modified files from the commit match this glob expression. -- `events` - (Optional) A list of GitHub events for which a Pipeline is triggered. Default value - **push.heads**. -- `provider` - (Optional) Default value - **github**. -- `context` - (Optional) Codefresh Git context. -- `commit_status_title` - (Optional) The commit status title pushed to the GIT version control system. -- `variables` - (Optional) Trigger variables. -- `disabled` - (Optional) Boolean. If true, trigger will never be activated. -- `pull_request_allow_fork_events` - (Optional) Boolean. If this trigger is also applicable to Git forks. -- `contexts` - (Optional) A list of strings representing the contexts ([shared_configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)) to be loaded when the trigger is executed -- `runtime_environment` - (Optional) A collection of `runtime_environment` blocks as documented below. -- `options`: (Optional) A collection `option` blocks as documented below. ---- +### Read-Only -`runtime_environment` supports the following: +- `id` (String) The ID of this resource. +- `project_id` (String) The ID of the project that the pipeline belongs to. +- `revision` (Number) The pipeline's revision. Should be added to the **lifecycle/ignore_changes** or incremented mannually each update. -- `name` - (Required) A name of runtime. -- `cpu` - (Optional) A required amount of CPU. -- `memory` - (Optional) A required amount of memory. -- `dind_storage` - (Optional) A pipeline shared storage. + +### Nested Schema for `spec` ---- +Optional: -`options` supports the following: +- `branch_concurrency` (Number) The maximum amount of concurrent builds that may run for each branch. Zero is unlimited (default: `0`). +- `concurrency` (Number) The maximum amount of concurrent builds. Zero is unlimited (default: `0`). +- `contexts` (List of String) A list of strings representing the contexts ([shared_configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)) to be configured for the pipeline. +- `options` (Block List, Max: 1) The options for the pipeline. (see [below for nested schema](#nestedblock--spec--options)) +- `pack_id` (String) SAAS pack (`5cd1746617313f468d669013` for Small; `5cd1746717313f468d669014` for Medium; `5cd1746817313f468d669015` for Large; `5cd1746817313f468d669017` for XL; `5cd1746817313f468d669018` for XXL). +- `priority` (Number) Helps to organize the order of builds execution in case of reaching the concurrency limit (default: `0`). +- `required_available_storage` (String) Minimum disk space required for build filesystem ( unit Gi is required). +- `runtime_environment` (Block List) The runtime environment for the pipeline. (see [below for nested schema](#nestedblock--spec--runtime_environment)) +- `spec_template` (Block List) The pipeline's spec template. (see [below for nested schema](#nestedblock--spec--spec_template)) +- `termination_policy` (Block List, Max: 1) The termination policy for the pipeline. (see [below for nested schema](#nestedblock--spec--termination_policy)) +- `trigger` (Block List) The pipeline's triggers (currently the only nested trigger supported is git; for other trigger types, use the `codefresh_pipeline_*_trigger` resources). (see [below for nested schema](#nestedblock--spec--trigger)) +- `trigger_concurrency` (Number) The maximum amount of concurrent builds that may run for each trigger (default: `0`). +- `variables` (Map of String) The pipeline's variables. -- `no_cache` - (Required) Boolean. If true, docker layer cache is disabled. Default false -- `no_cf_cache` - (Optional) Boolean. If true, extra Codefresh caching is disabled. Default false -- `reset_volume` - (Optional) Boolean. If true, all files on volume will be deleted before each execution. Default false -- `enable_notifications` - (Optional) Boolean. If false the pipeline will not send notifications to Slack and status updates back to the Git provider. Default false + +### Nested Schema for `spec.options` ---- +Optional: -`termination_policy` supports the following: +- `keep_pvcs_for_pending_approval` (Boolean) When build enters 'Pending Approval' state, volume should: + * Default (attribute not specified): "Use Setting accounts" + * true: "Remain (build remains active)" + * false: "Be removed" +- `pending_approval_concurrency_applied` (Boolean) Pipeline concurrency policy: Builds on 'Pending Approval' state should be: + * Default (attribute not specified): "Use Setting accounts" + * true: "Included in concurrency" + * false: "Not included in concurrency" -- `on_create_branch` - (Optional) A `on_create_branch` block as documented below. -- `on_terminate_annotation` - (Optional) Boolean. Enables the policy `Once a build is terminated, terminate all child builds initiated from it`. Default false. ---- + +### Nested Schema for `spec.runtime_environment` + +Optional: + +- `cpu` (String) The CPU allocated to the runtime environment. +- `dind_storage` (String) The storage allocated to the runtime environment. +- `memory` (String) The memory allocated to the runtime environment. +- `name` (String) The name of the runtime environment. + + + +### Nested Schema for `spec.spec_template` + +Required: -`on_create_branch` supports the following: +- `path` (String) The relative path to the Codefresh pipeline file. +- `repo` (String) The repository of the spec template (owner/repo). +- `revision` (String) The git revision of the spec template. -- `branch_name` - (Optional) A regular expression to filter the branches on with the termination policy applies. -- `ignore_trigger` - (Optional) Boolean. See table below for usage. -- `ignore_branch` - (Optional) Boolean. See table below for usage. +Optional: + +- `context` (String) The Codefresh git context (default: `github`). +- `location` (String) The location of the spec template (default: `git`). + + + +### Nested Schema for `spec.termination_policy` + +Optional: + +- `on_create_branch` (Block List, Max: 1) The following table presents how to configure this block based on the options available in the UI: -The following table presents how to configure this block based on the options available in the UI: | Option Description | Value Selected | on_create_branch | branch_name | ignore_trigger | ignore_branch | | ----------------------------------------------------------------------------- |:------------------------:|:----------------:|:-----------:|---------------:| -------------:| | Once a build is created terminate previous builds from the same branch | Disabled | Omit | N/A | N/A | N/A | @@ -189,24 +194,65 @@ The following table presents how to configure this block based on the options av | Once a build is created terminate previous builds only from a specific branch | From ANY trigger | Defined | Regex | true | N/A | | Once a build is created, terminate all other running builds | Disabled | Omit | N/A | N/A | N/A | | Once a build is created, terminate all other running builds | From the SAME trigger | Defined | N/A | false | true | -| Once a build is created, terminate all other running builds | From ANY trigger | Defined | N/A | true | true | +| Once a build is created, terminate all other running builds | From ANY trigger | Defined | N/A | true | true | (see [below for nested schema](#nestedblock--spec--termination_policy--on_create_branch)) +- `on_terminate_annotation` (Boolean) Enables the policy `Once a build is terminated, terminate all child builds initiated from it`. ---- + +### Nested Schema for `spec.termination_policy.on_create_branch` + +Optional: + +- `branch_name` (String) A regular expression to filter the branches on with the termination policy applies. +- `ignore_branch` (Boolean) Whether to ignore the branch. +- `ignore_trigger` (Boolean) Whether to ignore the trigger. + + + + +### Nested Schema for `spec.trigger` + +Optional: + +- `branch_regex` (String) A regular expression and will only trigger for branches that match this naming pattern (default: `/.*/gi`). +- `branch_regex_input` (String) Flag to manage how the `branch_regex` field is interpreted. Possible values: `multiselect-exclude`, `multiselect`, `regex` (default: `regex`). +- `comment_regex` (String) A regular expression and will only trigger for pull requests where a comment matches this naming pattern (default: `/.*/gi`). +- `commit_status_title` (String) The commit status title pushed to the git provider. +- `context` (String) The Codefresh git context. +- `contexts` (List of String) A list of strings representing the contexts ([shared_configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)) to be loaded when the trigger is executed. +- `description` (String) The description of the trigger. +- `disabled` (Boolean) Flag to disable the trigger. +- `events` (List of String) A list of GitHub events for which a Pipeline is triggered. +- `modified_files_glob` (String) Allows to constrain the build and trigger it only if the modified files from the commit match this glob expression (default: `""`). +- `name` (String) The name of the trigger. +- `options` (Block List) The trigger's options. (see [below for nested schema](#nestedblock--spec--trigger--options)) +- `provider` (String) The git provider tied to the trigger. +- `pull_request_allow_fork_events` (Boolean) If this trigger is also applicable to git forks. +- `pull_request_target_branch_regex` (String) A regular expression and will only trigger for pull requests to branches that match this naming pattern. +- `repo` (String) The repository name, (owner/repo) +- `runtime_environment` (Block List) The runtime environment for the trigger. (see [below for nested schema](#nestedblock--spec--trigger--runtime_environment)) +- `type` (String) The type of the trigger (default: `git`; see notes above). +- `variables` (Map of String) Trigger variables. + + +### Nested Schema for `spec.trigger.options` + +Optional: + +- `enable_notifications` (Boolean) If false the pipeline will not send notifications to Slack and status updates back to the Git provider. +- `no_cache` (Boolean) If true, docker layer cache is disabled +- `no_cf_cache` (Boolean) If true, extra Codefresh caching is disabled. +- `reset_volume` (Boolean) If true, all files on volume will be deleted before each execution. -`options` supports the following: -- `keep_pvcs_for_pending_approval` - (Optional) Boolean for the Settings under pending approval: `When build enters "Pending Approval" state, volume should`: - * Default (attribute not specified): "Use Setting accounts" - * true: "Remain (build remains active)" - * false: "Be removed" -- `pending_approval_concurrency_applied` - (Optional) Boolean for the Settings under pending approval: `Pipeline concurrency policy: Builds on "Pending Approval" state should be`: - * Default (attribute not specified): "Use Setting accounts" - * true: "Included in concurrency" - * false: "Not included in concurrency" + +### Nested Schema for `spec.trigger.runtime_environment` -## Attributes Reference +Optional: -- `id` - The Pipeline ID. +- `cpu` (String) The CPU allocated to the runtime environment. +- `dind_storage` (String) The storage allocated to the runtime environment. +- `memory` (String) The memory allocated to the runtime environment. +- `name` (String) The name of the runtime environment. ## Import diff --git a/docs/resources/pipeline_cron_trigger.md b/docs/resources/pipeline_cron_trigger.md index 602a7a7c..70027533 100644 --- a/docs/resources/pipeline_cron_trigger.md +++ b/docs/resources/pipeline_cron_trigger.md @@ -1,6 +1,14 @@ -# Pipeline Cron Trigger resource +--- +page_title: "codefresh_pipeline_cron_trigger Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + This resource is used to create cron-based triggers for pipeilnes. +--- + +# codefresh_pipeline_cron_trigger (Resource) + +This resource is used to create cron-based triggers for pipeilnes. -Pipeline Cron Trigger is used to create cron-based triggers for pipeilnes. See the [documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/triggers/cron-triggers/). ## Example usage @@ -24,14 +32,15 @@ resource "codefresh_pipeline_cron_trigger" "test" { } ``` -## Argument Reference + +## Schema -- `pipeline_id` - (Required) The pipeline to which this trigger belongs. -- `expression` - (Required) The cron expression. Visit [this page](https://github.com/codefresh-io/cronus/blob/master/docs/expression.md) to learn about the supported cron expression format and aliases. -- `message` - (Required) The message which will be passed to the pipeline upon each trigger. +### Required -## Attributes Reference +- `expression` (String) +- `message` (String) +- `pipeline_id` (String) -Along with all arguments above, the following attributes are exported: +### Read-Only -- `event` - The Event ID assigned to this trigger. \ No newline at end of file +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/project.md b/docs/resources/project.md index 781bcb72..b2547bdf 100644 --- a/docs/resources/project.md +++ b/docs/resources/project.md @@ -1,6 +1,18 @@ -# Project Resource +--- +page_title: "codefresh_project Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + The top-level concept in Codefresh. You can create projects to group pipelines that are related. + In most cases a single project will be a single application (that itself contains many micro-services). + You are free to use projects as you see fit. For example, you could create a project for a specific Kubernetes cluster or a specific team/department. +--- + +# codefresh_project (Resource) + +The top-level concept in Codefresh. You can create projects to group pipelines that are related. +In most cases a single project will be a single application (that itself contains many micro-services). +You are free to use projects as you see fit. For example, you could create a project for a specific Kubernetes cluster or a specific team/department. -The top-level concept in Codefresh. You can create projects to group pipelines that are related. In most cases a single project will be a single application (that itself contains many micro-services). You are free to use projects as you see fit. For example, you could create a project for a specific Kubernetes cluster or a specific team/department. More about pipeline concepts see in the [official documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/pipelines/#pipeline-concepts). ## Example Usage @@ -20,15 +32,21 @@ resource "codefresh_project" "test" { } ``` -## Argument Reference + +## Schema + +### Required + +- `name` (String) The display name for the project. + +### Optional -- `name` (Required) The display name for the project. -- `tags` (Optional) A list of tags to mark a project for easy management and access control. -- `variables` (Optional) project variables. +- `tags` (Set of String) A list of tags to mark a project for easy management and access control. +- `variables` (Map of String) Project variables. -## Attributes Reference +### Read-Only -- `id` - The Project ID +- `id` (String) The ID of this resource. ## Import diff --git a/docs/resources/registry.md b/docs/resources/registry.md index a003ed3d..c4abd95b 100644 --- a/docs/resources/registry.md +++ b/docs/resources/registry.md @@ -1,6 +1,14 @@ -# Registry Resource +--- +page_title: "codefresh_registry Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + Registry is the configuration that Codefresh uses to push/pull container images. +--- + +# codefresh_registry (Resource) + +Registry is the configuration that Codefresh uses to push/pull container images. -Registry is the configuration that Codefresh uses to push/pull docker images. For more details see the [Codefresh Docker Registries](https://codefresh.io/docs/docs/integrations/docker-registries/) @@ -70,195 +78,129 @@ resource "codefresh_registry" "some_registry" { } ``` + +## Schema -### Common fields +### Required -* `name` - `(Required)` some unique name for registry -* `default` - `(Optional, Default = false)` see the [Default Registry](https://codefresh.io/docs/docs/integrations/docker-registries/#the-default-registry) -* `primary` - `(Optional, Default = true)` see the [Multiple Registries](https://codefresh.io/docs/docs/ci-cd-guides/working-with-docker-registries/#working-with-multiple-registries-with-the-same-domain) -* `fallback_registry` - `(Optional)` see the [Fallback Registry](https://codefresh.io/docs/docs/integrations/docker-registries/#fallback-registry) +- `name` (String) The display name for the registry. +- `spec` (Block List, Min: 1, Max: 1) The registry's specs. (see [below for nested schema](#nestedblock--spec)) +### Optional -### Default registry usage +- `default` (Boolean) Whether this registry is the default registry (default: `false`). +- `fallback_registry` (String) The name of the fallback registry. +- `primary` (Boolean) Whether this registry is the primary registry (default: `true`). -If you want to manage default registry by Codefresh terraform provider correctly, -you need to mark only one registry as `default = true` +### Read-Only -```hcl -resource "codefresh_registry" "dockerhub" { - name = "dockerhub" - - spec { - dockerhub { - # some specific fields here - } - } -} +- `id` (String) The ID of this resource. +- `kind` (String) The kind of registry. -# this registry will be default -resource "codefresh_registry" "gcr" { - name = "gcr" - default = true - fallback_registry = codefresh_registry.some_other_registry.id - - spec { - gcr { - # some specific fields here - } - } -} -``` + +### Nested Schema for `spec` -### Primary registry usage +Optional: -If you are using [Multiple Registries](https://codefresh.io/docs/docs/ci-cd-guides/working-with-docker-registries/#working-with-multiple-registries-with-the-same-domain) feature -you need to manually mark each registry of the same domain as non-primary and only one as primary +- `acr` (Block List, Max: 1) An `acr` block as documented below ([Azure Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/azure-docker-registry)). (see [below for nested schema](#nestedblock--spec--acr)) +- `bintray` (Block List, Max: 1) A `bintray` block as documented below ([Bintray / Artifactory](https://codefresh.io/docs/docs/integrations/docker-registries/bintray-io)). (see [below for nested schema](#nestedblock--spec--bintray)) +- `dockerhub` (Block List, Max: 1) A `dockerhub` block as documented below ([Docker Hub Registry](https://codefresh.io/docs/docs/integrations/docker-registries/docker-hub/)). (see [below for nested schema](#nestedblock--spec--dockerhub)) +- `ecr` (Block List, Max: 1) An `ecr` block as documented below ([Amazon EC2 Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/amazon-ec2-container-registry)). (see [below for nested schema](#nestedblock--spec--ecr)) +- `gar` (Block List, Max: 1) A `gar` block as documented below ([Google Artifact Registry](https://codefresh.io/docs/docs/integrations/docker-registries/google-artifact-registry)). (see [below for nested schema](#nestedblock--spec--gar)) +- `gcr` (Block List, Max: 1) [Google Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/google-container-registry). (see [below for nested schema](#nestedblock--spec--gcr)) +- `other` (Block List, Max: 1) `other` provider block described below ([Other Providers](https://codefresh.io/docs/docs/integrations/docker-registries/other-registries)). (see [below for nested schema](#nestedblock--spec--other)) -```hcl -# this registry will be primary -resource "codefresh_registry" "dockerhub" { - name = "dockerhub" - primary = true - - spec { - dockerhub { - # some specific fields here - } - } -} + +### Nested Schema for `spec.acr` -resource "codefresh_registry" "dockerhub1" { - name = "dockerhub1" - primary = false +Required: - spec { - dockerhub { - # some specific fields here - } - } -} +- `client_id` (String) The Client ID. +- `client_secret` (String, Sensitive) The Client Secret. +- `domain` (String) The ACR registry domain. -resource "codefresh_registry" "dockerhub2" { - name = "dockerhub2" - primary = false +Optional: - spec { - dockerhub { - # some specific fields here - } - } -} -``` +- `repository_prefix` (String) See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). -### Fallback registry usage -If you want to use one of your registries as fallback you need to specify its id -for `fallback_registry` field of another registry + +### Nested Schema for `spec.bintray` -```hcl -resource "codefresh_registry" "dockerhub" { - name = "dockerhub" - - spec { - dockerhub { - # some specific fields here - } - } -} +Required: -resource "codefresh_registry" "gcr" { - name = "gcr" - - # here we take the id of "dockerhub" registry - fallback_registry = codefresh_registry.dockerhub.id - - spec { - gcr { - # some specific fields here - } - } -} -``` +- `domain` (String) The Bintray domain. +- `token` (String, Sensitive) The Bintray token. +- `username` (String) The Bintray username. -## Argument Reference +Optional: -- `name` - _(Required)_ some unique name for registry -- `default` - _(Optional, Default = false)_ default registry -- `primary` - _(Optional, Default = true)_ primary registry -- `fallback_registry` - _(Optional)_ fallback registry -- `spec` - _(Required)_ A `spec` block as documented below. +- `repository_prefix` (String) See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). ---- -`spec` supports the following (Note: only 1 of the below can be specified at any time): + +### Nested Schema for `spec.dockerhub` -- dockerhub - _(Optional)_ A `dockerhub` block as documented below ([Docker Hub Registry](https://codefresh.io/docs/docs/integrations/docker-registries/docker-hub/)) -- acr - _(Optional)_ An `acr` block as documented below ([Azure Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/azure-docker-registry)) -- gcr - _(Optional)_ A `gcr` block as documented below ([Google Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/google-container-registry)) -- gar - _(Optional)_ A `gar` block as documented below ([Google Artifact Registry](https://codefresh.io/docs/docs/integrations/docker-registries/google-artifact-registry)) -- ecr - _(Optional)_ An `ecr` block as documented below ([Amazon EC2 Container Registry](https://codefresh.io/docs/docs/integrations/docker-registries/amazon-ec2-container-registry)) -- bintray - _(Optional)_ A `bintray` block as documented below ([Bintray / Artifactory](https://codefresh.io/docs/docs/integrations/docker-registries/bintray-io)) -- other - _(Optional)_ `other` provider block described below ([Other Providers](https://codefresh.io/docs/docs/integrations/docker-registries/other-registries)). +Required: +- `password` (String, Sensitive) The DockerHub password. +- `username` (String) The DockerHub username. ---- -`dockerhub` supports the following: + +### Nested Schema for `spec.ecr` -- `username` - _(Required)_ String. -- `password` - _(Required, Sensitive)_ String. +Required: ---- +- `access_key_id` (String) The AWS access key ID. +- `region` (String) The AWS region. +- `secret_access_key` (String, Sensitive) The AWS secret access key. -`acr` supports the following: +Optional: -- `domain` - _(Required)_ String representing your acr registry domain. -- `client_id` - _(Required)_ String representing client id. -- `client_secret` - _(Required)_ String representing client secret. -- `repository_prefix` - _(Optional)_ String. See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). +- `repository_prefix` (String) See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). ---- -`gcr` supports the following: + +### Nested Schema for `spec.gar` -- `domain` - _(Required)_ String representing one of the Google's gcr domains -- `keyfile` - _(Required)_ String representing service account json file contents -- `repository_prefix` - _(Optional)_ String. See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). +Required: ---- +- `keyfile` (String, Sensitive) The serviceaccount json file contents. +- `location` (String) The GAR location. -`gar` supports the following: +Optional: -- `location` - _(Required)_ String representing one of the Google's gar locations -- `keyfile` - _(Required)_ String representing service account json file contents -- `repository_prefix` - _(Optional)_ String. See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). +- `repository_prefix` (String) See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). ---- -`ecr` supports the following: + +### Nested Schema for `spec.gcr` -- `region` - _(Required)_ String representing one of the Amazon regions -- `access_key_id` - _(Required)_ String representing access key id -- `secret_access_key` - _(Required)_ String representing secret access key -- `repository_prefix` - _(Optional)_ String. See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). +Required: ---- +- `domain` (String) The GCR registry domain. +- `keyfile` (String, Sensitive) The serviceaccount json file contents. -`bintray` supports the following: +Optional: -- `domain` - _(Required)_ String representing the bintray domain -- `username` - _(Required)_ String representing the username -- `token` - _(Required)_ String representing token -- `repository_prefix` - _(Optional)_ String. See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). +- `repository_prefix` (String) See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). ---- -`other` supports the following: + +### Nested Schema for `spec.other` + +Required: + +- `domain` (String) The domain. +- `password` (String, Sensitive) The password. +- `username` (String) The username. + +Optional: -- `domain` - _(Required)_ String representing the bintray domain -- `username` - _(Required)_ String representing the username -- `password` - _(Required)_ String representing token -- `repository_prefix` - _(Optional)_ String. See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). -- `behind_firewall` - _(Optional, Default = false)_ Bool. See the [docs](https://codefresh.io/docs/docs/administration/behind-the-firewall/#accessing-an-internal-docker-registry). +- `behind_firewall` (Boolean) See the [docs](https://codefresh.io/docs/docs/administration/behind-the-firewall/#accessing-an-internal-docker-registry). +- `repository_prefix` (String) See the [docs](https://codefresh.io/docs/docs/integrations/docker-registries/#using-an-optional-repository-prefix). ---- \ No newline at end of file +```sh +terraform import codefresh_registry.test xxxxxxxxxxxxxxxxxxx +``` \ No newline at end of file diff --git a/docs/resources/step_types.md b/docs/resources/step_types.md new file mode 100644 index 00000000..b26025e2 --- /dev/null +++ b/docs/resources/step_types.md @@ -0,0 +1,72 @@ +--- +page_title: "codefresh_step_types Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + This resource allows to create your own typed step and manage all of its published versions. + The resource allows to handle the life-cycle of the version by allowing specifying multiple blocks 'version' where the user provides a version number and the yaml file representing the plugin. +--- + +# codefresh_step_types (Resource) + +This resource allows to create your own typed step and manage all of its published versions. +The resource allows to handle the life-cycle of the version by allowing specifying multiple blocks 'version' where the user provides a version number and the yaml file representing the plugin. + +More about custom steps in the [official documentation](https://codefresh.io/docs/docs/codefresh-yaml/steps/#creating-a-typed-codefresh-plugin). + +## Known limitations and disclaimers + +### Version and name in yaml Metadata are ignored. + +The version and name of the step declared in the yaml files are superseeded by the attributes specified at resource level: +- `name` : at top level +- `version_numer`: specified in the `version` block +The above are added/replaced at runtime time. + +### Number of API requests + +This resource makes a lot of additional API calls to validate the steps and retrieve all the version available. +Caution is recommended on the amount of versions maintained and the number of resources defined in a single project. + + +## Example Usage + +```hcl + +data "codefresh_current_account" "acc" { +} + +resource "codefresh_step_types_versions" "my-custom-step" { + name = "${data.codefresh_current_account.acc.name}/my-custom-step" + + version { + version_number = "0.0.1" + step_types_yaml = file("./templates/plugin-0.0.1.yaml") + } + version { + version_number = "0.0.2" + step_types_yaml = file("./templates/plugin-0.0.2.yaml") + } + .... +} +} +``` + + +## Schema + +### Required + +- `name` (String) The name for the step-type +- `version` (Set of Object) The versions of the step-type (see [below for nested schema](#nestedatt--version)) + +### Read-Only + +- `id` (String) The ID of this resource. + + +### Nested Schema for `version` + +Required: + +- `step_types_yaml` (String) +- `version_number` (String) diff --git a/docs/resources/team.md b/docs/resources/team.md index 72e52622..e4d0c64d 100644 --- a/docs/resources/team.md +++ b/docs/resources/team.md @@ -1,6 +1,14 @@ -# Team resource +--- +page_title: "codefresh_team Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + Teams are groups of users that are used to enforce access control. +--- + +# codefresh_team (Resource) + +Teams are groups of users that are used to enforce access control. -Team is used as a part of access control and allow to define what teams have access to which clusters and pipelines. See the [documentation](https://codefresh.io/docs/docs/administration/access-control/). ## Example usage @@ -17,16 +25,22 @@ resource "codefresh_team" "developers" { } ``` -## Argument Reference + +## Schema + +### Required + +- `name` (String) The name of the team. + +### Optional -- `name` - (Required) The display name for the team. -- `type` - (Optional) The type of the team. Possible values: - - __default__ - - __admin__ -- `tags` - (Optional) A list of tags to mark a team for easy management. -- `users` - (Optional) A list of user IDs that should be in the team. +- `account_id` (String) The account id where to create the team. +- `tags` (Set of String) The tags of the team. +- `type` (String) The type of the team. Possible values: + * __default__ + * __admin__ +- `users` (Set of String) A list of user IDs that should be in the team. -## Attributes Reference +### Read-Only -- `id` - The Team ID. -- `account_id` - The relevant Account ID. \ No newline at end of file +- `id` (String) The ID of this resource. \ No newline at end of file diff --git a/docs/resources/user.md b/docs/resources/user.md index 7ff25933..888c9d51 100644 --- a/docs/resources/user.md +++ b/docs/resources/user.md @@ -1,6 +1,15 @@ -# User resource +--- +page_title: "codefresh_user Resource - terraform-provider-codefresh" +subcategory: "" +description: |- + This resource is used to manage a Codefresh user. +--- + +# codefresh_user (Resource) + +This resource is used to manage a Codefresh user. + -Use this resource to create a new user. ## Example usage @@ -53,43 +62,55 @@ resource "codefresh_user" "new" { } ``` -## Argument Reference + +## Schema -- `email` - (Required) A new user email. -- `user_name` - (Required) The new user name. -- `activate` - (Optional) Boolean. Activate the new use or not. If a new user is not activate, it'll be left pending. -- `accounts` - (Optional) A list of accounts to add to the user. -- `personal` - (Optional) A collection of `personal` blocks as documented below. -- `accounts` - (Optional) A list of user roles. Possible values - `Admin`, `User`. -- `login` - (Optional) A collection of `login` blocks as documented below. +### Required ---- +- `accounts` (Set of String) A list of accounts IDs to assign the user to. +- `email` (String) The email of the user. +- `user_name` (String) The username of the user. -`personal` supports the following: +### Optional -- `first_name` - (Optional). -- `last_name` - (Optional). -- `company_name` - (Optional). -- `phone_number` - (Optional). -- `country` - (Optional). +- `activate` (Boolean) Whether to activate the user or to leave it as `pending`. +- `login` (Block Set) Login settings for the user. (see [below for nested schema](#nestedblock--login)) +- `personal` (Block List, Max: 1) Personal information about the user. (see [below for nested schema](#nestedblock--personal)) +- `roles` (Set of String) The roles of the user. ---- +### Read-Only + +- `id` (String) The ID of this resource. +- `short_profile` (List of Object) The computed short profile of the user. (see [below for nested schema](#nestedatt--short_profile)) +- `status` (String) The status of the user (e.g. `new`, `pending`). + + +### Nested Schema for `login` + +Optional: + +- `idp_id` (String) The IdP ID for the user's login. +- `sso` (Boolean) Whether to enforce SSO for the user. + + + +### Nested Schema for `personal` + +Optional: -`login` supports the following: -- `credentials` - - `permissions` - (Optional) A list of permissions. -- `idp` - - `idp_id` - (Optional) The id of IDP to the user to. - - `client_type` - (Optional) IDP type. ex. - `github`, `azure`, etc. +- `company_name` (String) The company name of the user. +- `country` (String) The country of the user. +- `first_name` (String) The first name of the user. +- `last_name` (String) The last name of the user. +- `phone_number` (String) The phone number of the user. -## Attributes Reference -- `id` - The User ID. -- `short_profile` - - `user_name` -- `status`. Current status of the user. ex - `new`, `pengind`. + +### Nested Schema for `short_profile` +Read-Only: +- `user_name` (String) ## Import diff --git a/go.mod b/go.mod index f8c4f06f..76154dbb 100644 --- a/go.mod +++ b/go.mod @@ -16,10 +16,137 @@ require ( github.com/imdario/mergo v0.3.12 github.com/robfig/cron v1.2.0 github.com/stretchr/objx v0.1.1 + gopkg.in/yaml.v2 v2.3.0 +) + +require ( + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157 // indirect + github.com/OpenPeeDeeP/depguard v1.0.1 // indirect + github.com/agext/levenshtein v1.2.2 // indirect + github.com/apparentlymart/go-cidr v1.1.0 // indirect + github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect + github.com/armon/go-radix v1.0.0 // indirect + github.com/bflad/gopaniccheck v0.1.0 // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/bmatcuk/doublestar v1.2.1 // indirect + github.com/bombsimon/wsl/v3 v3.0.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fatih/color v1.13.0 // indirect + github.com/fsnotify/fsnotify v1.4.7 // indirect + github.com/go-critic/go-critic v0.4.1 // indirect + github.com/go-lintpack/lintpack v0.5.2 // indirect + github.com/go-toolsmith/astcast v1.0.0 // indirect + github.com/go-toolsmith/astcopy v1.0.0 // indirect + github.com/go-toolsmith/astequal v1.0.0 // indirect + github.com/go-toolsmith/astfmt v1.0.0 // indirect + github.com/go-toolsmith/astp v1.0.0 // indirect + github.com/go-toolsmith/strparse v1.0.0 // indirect + github.com/go-toolsmith/typep v1.0.0 // indirect + github.com/gobwas/glob v0.2.3 // indirect + github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b // indirect + github.com/gogo/protobuf v1.2.1 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect + github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect + github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 // indirect + github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 // indirect + github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 // indirect + github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee // indirect + github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a // indirect + github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc // indirect + github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect + github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect + github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770 // indirect + github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect + github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 // indirect + github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect + github.com/google/go-cmp v0.5.9 // indirect + github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-checkpoint v0.5.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-hclog v1.2.1 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-plugin v1.4.8 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/hashicorp/go-version v1.6.0 // indirect + github.com/hashicorp/hc-install v0.4.0 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/hcl/v2 v2.14.0 // indirect + github.com/hashicorp/logutils v1.0.0 // indirect + github.com/hashicorp/terraform-exec v0.17.3 // indirect + github.com/hashicorp/terraform-json v0.14.0 // indirect + github.com/hashicorp/terraform-plugin-go v0.14.3 // indirect + github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect + github.com/hashicorp/terraform-registry-address v0.1.0 // indirect + github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect + github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a // indirect + github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3 // indirect + github.com/kisielk/gotool v1.0.0 // indirect + github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect + github.com/magiconair/properties v1.8.1 // indirect + github.com/maratori/testpackage v1.0.1 // indirect + github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mitchellh/cli v1.1.1 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/go-wordwrap v1.0.0 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/nakabonne/nestif v0.3.0 // indirect + github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect + github.com/oklog/run v1.0.0 // indirect + github.com/pelletier/go-toml v1.2.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/posener/complete v1.2.1 // indirect + github.com/ryancurrah/gomodguard v1.0.4 // indirect + github.com/securego/gosec/v2 v2.3.0 // indirect + github.com/sirupsen/logrus v1.4.2 // indirect + github.com/sourcegraph/go-diff v0.5.1 // indirect + github.com/spf13/afero v1.2.2 // indirect + github.com/spf13/cast v1.3.0 // indirect + github.com/spf13/cobra v0.0.5 // indirect + github.com/spf13/jwalterweatherman v1.0.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.6.1 // indirect + github.com/stretchr/testify v1.7.2 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 // indirect + github.com/tetafro/godot v0.3.7 // indirect + github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e // indirect + github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa // indirect + github.com/ultraware/funlen v0.0.2 // indirect + github.com/ultraware/whitespace v0.0.4 // indirect + github.com/uudashr/gocognit v1.0.1 // indirect + github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect + github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect + github.com/vmihailenco/tagparser v0.1.1 // indirect + github.com/zclconf/go-cty v1.11.0 // indirect + golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect + golang.org/x/text v0.4.0 // indirect golang.org/x/tools v0.1.12 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - gopkg.in/yaml.v2 v2.3.0 + google.golang.org/appengine v1.6.6 // indirect + google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect + google.golang.org/grpc v1.51.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/ini.v1 v1.51.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + honnef.co/go/tools v0.0.1-2020.1.4 // indirect + mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect + mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect + mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f // indirect + sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 // indirect ) -go 1.13 +go 1.18 diff --git a/go.sum b/go.sum index bbcaac34..b8cf2646 100644 --- a/go.sum +++ b/go.sum @@ -58,16 +58,13 @@ github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/g github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= -github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= @@ -76,7 +73,6 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -100,7 +96,6 @@ github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEe github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -108,11 +103,6 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= @@ -133,19 +123,15 @@ github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3 github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/go-critic/go-critic v0.4.1 h1:4DTQfT1wWwLg/hzxwD9bkdhDQrdJtxe6DUTadPlrIeE= github.com/go-critic/go-critic v0.4.1/go.mod h1:7/14rZGnZbY6E38VEGk2kVhoq6itzc1E68facVDK23g= @@ -156,7 +142,6 @@ github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= -github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2SubfXjIWgci8= github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM= github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= @@ -229,7 +214,6 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -275,7 +259,6 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -291,7 +274,6 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gookit/color v1.2.4/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg= @@ -303,7 +285,6 @@ github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.m github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= @@ -329,8 +310,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.3.0/go.mod h1:F9eH4LrE/ZsRdbwhfjs9k9HoDUwAHnYtXdgmf1AVNs0= github.com/hashicorp/go-plugin v1.4.0/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= -github.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ= -github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= +github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM= +github.com/hashicorp/go-plugin v1.4.8/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -366,8 +347,8 @@ github.com/hashicorp/terraform-json v0.8.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+ github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= github.com/hashicorp/terraform-plugin-go v0.2.1/go.mod h1:10V6F3taeDWVAoLlkmArKttR3IULlRWFAGtQIQTIDr4= -github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4= -github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE= +github.com/hashicorp/terraform-plugin-go v0.14.3 h1:nlnJ1GXKdMwsC8g1Nh05tK2wsC3+3BL/DBBxFEki+j0= +github.com/hashicorp/terraform-plugin-go v0.14.3/go.mod h1:7ees7DMZ263q8wQ6E4RdIdR6nHHJtrdt4ogX5lPkX1A= github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs= github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4= github.com/hashicorp/terraform-plugin-sdk v1.16.1 h1:G2iK7MBT4LuNcVASPXWS1ciBUuIm8oIY0zRfCmi3xy4= @@ -376,8 +357,8 @@ github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0/go.mod h1:z+cMZ0iswzZOahBJ3X github.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0 h1:D4EeQm0piYXIHp6ZH3zjyP2Elq6voC64x3GZptaiefA= github.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0/go.mod h1:xkJGavPvP9kYS/VbiW8o7JuTNgPwm7Tiw/Ie/b46r4c= github.com/hashicorp/terraform-plugin-test/v2 v2.1.3/go.mod h1:pmaUHiUtDL/8Mz3FuyZ/vRDb0LpaOWQjVRW9ORF7FHs= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c h1:D8aRO6+mTqHfLsK/BC3j5OAoogv1WLRWzY1AaTo3rBg= -github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c/go.mod h1:Wn3Na71knbXc1G8Lh+yu/dQWWJeFQEpDeJMtWMtlmNI= +github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U= +github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= @@ -448,7 +429,6 @@ github.com/maratori/testpackage v1.0.1 h1:QtJ5ZjqapShm0w5DosRjg0PRlSdAdlx+W6cCKo github.com/maratori/testpackage v1.0.1/go.mod h1:ddKdw+XG0Phzhx8BFDTKgpWP4i7MpApTE5fXSKAqwDU= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= -github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= @@ -501,7 +481,6 @@ github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5w github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= @@ -540,7 +519,6 @@ github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1: github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/ryancurrah/gomodguard v1.0.4 h1:oCreMAt9GuFXDe9jW4HBpc3GjdX3R/sUEcLAGh1zPx8= @@ -551,7 +529,6 @@ github.com/securego/gosec/v2 v2.3.0/go.mod h1:UzeVyUXbxukhLeHKV3VVqo7HdoQR9MrRfF github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= -github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= @@ -638,13 +615,11 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.2.1/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= github.com/zclconf/go-cty v1.7.1/go.mod h1:VDR4+I79ubFBGm1uJac1226K5yANQFHeauxPBoP54+o= -github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0= github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= @@ -656,7 +631,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -673,7 +647,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167 h1:O8uGbHCqlTp2P6QJSLmCojM4mN6UemYv8K+dCnmHmu0= golang.org/x/crypto v0.0.0-20220517005047-85d78b3ac167/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -747,7 +720,6 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -765,7 +737,6 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -808,31 +779,25 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -953,7 +918,6 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= @@ -979,11 +943,8 @@ google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -996,7 +957,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -1020,7 +980,6 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/main.go b/main.go index 18eb1751..ac8ab335 100644 --- a/main.go +++ b/main.go @@ -1,34 +1,23 @@ package main import ( - "context" - "log" "os" "github.com/codefresh-io/terraform-provider-codefresh/codefresh" "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" - //"github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) +// Generate the Terraform provider documentation using `tfplugindocs`: +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs + func main() { - debugMode := (os.Getenv("CODEFRESH_PLUGIN_DEBUG") != "") - // for terraform 0.13: export CODEFRESH_PLUGIN_ADDR="codefresh.io/app/codefresh" - providerAddr := os.Getenv("CODEFRESH_PLUGIN_ADDR") + debugMode := (os.Getenv(codefresh.ENV_CODEFRESH_PLUGIN_DEBUG) != "") + providerAddr := os.Getenv(codefresh.ENV_CODEFRESH_PLUGIN_ADDR) if providerAddr == "" { - providerAddr = "registry.terraform.io/-/codefresh" - } - if debugMode { - err := plugin.Debug(context.Background(), providerAddr, - &plugin.ServeOpts{ - ProviderFunc: codefresh.Provider, - }) - if err != nil { - log.Println(err.Error()) - } - } else { - plugin.Serve(&plugin.ServeOpts{ - ProviderFunc: codefresh.Provider, - }, - ) + providerAddr = codefresh.DEFAULT_CODEFRESH_PLUGIN_ADDR } + plugin.Serve(&plugin.ServeOpts{ + ProviderFunc: codefresh.Provider, + Debug: debugMode, + }) } diff --git a/docs/data/account.md b/templates/data-sources/account.md.tmpl similarity index 63% rename from docs/data/account.md rename to templates/data-sources/account.md.tmpl index 6945569e..e640a19f 100644 --- a/docs/data/account.md +++ b/templates/data-sources/account.md.tmpl @@ -1,6 +1,17 @@ -# account data module +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- -``` +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +```hcl data "codefresh_account" "acc" { name = "acc1" } @@ -36,4 +47,6 @@ resource "codefresh_user" "user1" { last_name = "Smith" } } -``` \ No newline at end of file +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/context.md.tmpl b/templates/data-sources/context.md.tmpl new file mode 100644 index 00000000..ddf0c080 --- /dev/null +++ b/templates/data-sources/context.md.tmpl @@ -0,0 +1,54 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +```hcl +# Assuming runtimes-list is a context of type "config" with the following values +# runtime_a: dev +# runtime_b: test +# runtime_c: prod + +data "codefresh_context" "runtimes_list" { + name = "runtimes-list" +} + +resource "codefresh_project" "test" { + name = "myproject" +} + +resource "codefresh_pipeline" "test" { + + lifecycle { + ignore_changes = [ + revision + ] + } + + name = "${codefresh_project.test.name}/react-sample-app" + + runtime_environment { + name = yamldecode(data.codefresh_context.runtimes_list.data).runtime_a + } + + spec { + + spec_template { + repo = "codefresh-contrib/react-sample-app" + path = "./codefresh.yml" + revision = "master" + context = "git" + } + } +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/docs/data/current_accont.md b/templates/data-sources/current_account.md.tmpl similarity index 68% rename from docs/data/current_accont.md rename to templates/data-sources/current_account.md.tmpl index d213d169..e34be0c6 100644 --- a/docs/data/current_accont.md +++ b/templates/data-sources/current_account.md.tmpl @@ -1,6 +1,16 @@ -# current_account data module +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage -Return current account (owner of the token) and its users ```hcl provider "codefresh" { api_url = var.api_url @@ -38,4 +48,6 @@ current_ac = { }, ] } -``` \ No newline at end of file +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/docs/data/idps.md b/templates/data-sources/idps.md.tmpl similarity index 78% rename from docs/data/idps.md rename to templates/data-sources/idps.md.tmpl index 828ba029..46e91818 100644 --- a/docs/data/idps.md +++ b/templates/data-sources/idps.md.tmpl @@ -1,4 +1,16 @@ -# data codefresh_idps +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + ``` data "codefresh_idps" "idp_azure" { display_name = "codefresh-onprem-tst-2" @@ -63,4 +75,6 @@ resource "codefresh_idp_accounts" "acc_idp" { idp_id = data.codefresh_idps.idp_azure.id account_ids = [codefresh_account.acc.id] } -``` \ No newline at end of file +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/registry.md.tmpl b/templates/data-sources/registry.md.tmpl new file mode 100644 index 00000000..a806ae79 --- /dev/null +++ b/templates/data-sources/registry.md.tmpl @@ -0,0 +1,36 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +```hcl +# some pre-existing registry +data "codefresh_registry" "dockerhub" { + name = "dockerhub" +} + +# example with using data reference to existing registry, not managed by terraform +# "dockerhub" registry will be used as fallback for "dockerhub1" +resource "codefresh_registry" "dockerhub1" { + name = "dockerhub1" + primary = !data.codefresh_registry.dockerhub.primary + + spec { + dockerhub { + username = "test" + password = "test" + } + } + fallback_registry = data.codefresh_registry.dockerhub.id +} +``` + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/data-sources/step_types.md.tmpl b/templates/data-sources/step_types.md.tmpl new file mode 100644 index 00000000..c52213cf --- /dev/null +++ b/templates/data-sources/step_types.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +```hcl +data "codefresh_step_types" "freestyle" { + name = "freestyle" +} + +local { + freestyle_map = { for step_definition in data.codefresh_step_types.freestyle.version: step_definition.version_number => step_definition } +} + +output "test" { + # Value is return as YAML + value = local.freestyle_map[keys(local.freestyle_map)[0]].version_number +} + +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/team.md.tmpl b/templates/data-sources/team.md.tmpl new file mode 100644 index 00000000..302ad11e --- /dev/null +++ b/templates/data-sources/team.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +```hcl +data "codefresh_team" "admin" { + provider = codefresh.acc1 + name = "users" +} + +resource "codefresh_permission" "permission2" { + provider = codefresh.acc1 + team = data.codefresh_team.admin.id + action = "create" + resource = "pipeline" + tags = ["frontend"] +} + +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/user.md.tmpl b/templates/data-sources/user.md.tmpl new file mode 100644 index 00000000..3a1a2dff --- /dev/null +++ b/templates/data-sources/user.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example usage + +```hcl +data "codefresh_user" "admin" { + email = "admin@codefresh.io" +} + +resource "codefresh_team" "admins" { + + name = "testsuperteam123" + + users = [ + data.codefresh_user.admin.user_id, + "", + ] +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/data-sources/users.md.tmpl b/templates/data-sources/users.md.tmpl new file mode 100644 index 00000000..f0037849 --- /dev/null +++ b/templates/data-sources/users.md.tmpl @@ -0,0 +1,19 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example usage + +```hcl +data "codefresh_users" "users" {} +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/guides/development.md.tmpl b/templates/guides/development.md.tmpl new file mode 100644 index 00000000..fbb3944a --- /dev/null +++ b/templates/guides/development.md.tmpl @@ -0,0 +1,71 @@ +## Development + +We are currently using [Terraform Plugin SDK v2](https://github.com/hashicorp/terraform-plugin-sdk). + +It is possible that we will switch to the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework) sometime in the future. + +### Prerequisites (other than Terraform) + +- GNU Make +- [Go](https://golang.org/doc/install) `1.(n-2).x` (minimum supported Go version required to build the provider; n is the latest minor version listed [here](https://go.dev/dl/)). + +### Building and Running a Local Build of the Provider + +```bash +make install +``` + +Set the [developer overrides](https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers) to point Terraform at the locally-built binary: + +```terraform +# `~/.terraformrc (Windows: %APPDATA%/.terraformrc) +provider_installation { + dev_overrides { + "codefresh.io/codefresh" = "[REPLACE WITH GOPATH]/bin" + } + direct {} +} +``` + +Note that if developer overrides are set, Terraform will ignore the version pinned in `versions.tf`, so you do not need to remove the version pin when testing. You can keep it. + +### Debugging with Delve + +[Reference guide](https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#support-for-debuggable-provider-binaries) + +[SDK code](https://github.com/hashicorp/terraform-plugin-sdk/blob/v2.0.0-rc.2/plugin/debug.go#L97) + +Run the provider with `CODEFRESH_PLUGIN_DEBUG=true` in Delve debugger. + +For vscode, set `launch.json` as follows: + +```json +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.1", + "configurations": [ + { + "name": "terraform-provider-codefresh", + "type": "go", + "request": "launch", + "mode": "debug", + "port": 2345, + "host": "127.0.0.1", + "env": {"CODEFRESH_PLUGIN_DEBUG": "true"}, + "program": "/home/mitchellh/go/src/github.com/codefresh-io/terraform-provider-codefresh/main.go", + "showLog": true, + "trace": "verbose" + } + ] +} +``` + +Then, copy the value of `TF_REATTACH_PROVIDERS` from the output of debug console and set it for terraform exec: + +```bash +export TF_REATTACH_PROVIDERS='{"registry.terraform.io/-/codefresh":{"Protocol":"grpc","Pid":614875,"Test":true,"Addr":{"Network":"unix","String":"/tmp/plugin369955425"}}}' + +terraform apply +``` diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl new file mode 100644 index 00000000..7cefcb51 --- /dev/null +++ b/templates/index.md.tmpl @@ -0,0 +1,46 @@ +--- +layout: "codefresh" +page_title: "Provider: Codefresh" +sidebar_current: "docs-codefresh-index" +description: |- + The Codefresh provider is used to manage Codefresh resources. +--- + +# {{ .ProviderShortName | title }} Provider + +The {{ .ProviderShortName | title }} Provider can be used to configure [Codefresh](https://codefresh.io/) resources - pipelines, projects, accounts, etc using the [Codefresh API](https://codefresh.io/docs/docs/integrations/codefresh-api/). + +## Authenticating to Codefresh + +The Codefresh API requires the [authentication key](https://codefresh.io/docs/docs/integrations/codefresh-api/#authentication-instructions) to authenticate. +The key can be passed either as the provider's attribute or as environment variable - `CODEFRESH_API_KEY`. + +{{ .SchemaMarkdown | trimspace }} + +## Managing Resources Across Different Accounts + +The Codefresh API only allows one to operate with the entities in the account tied to the API Key the provider is configured for. + +To be able to operate with entities in different accounts, you should create a new key in the relevant account and use providers [aliases](https://www.terraform.io/docs/configuration/providers.html#alias-multiple-provider-instances). + +For example: + +```hcl +provider "codefresh" { + api_key = "..." +} + +provider "codefresh" { + api_key = "..." + alias = "acme-dev" +} + +resource "codefresh_pipeline" "pipeline" { + ... # Omited for brevity +} + +resource "codefresh_pipeline" "pipeline-dev" { + provider = codefresh.acme-dev + ... # Omited for brevity +} +``` \ No newline at end of file diff --git a/templates/resources/account.md.tmpl b/templates/resources/account.md.tmpl new file mode 100644 index 00000000..b466af25 --- /dev/null +++ b/templates/resources/account.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +See the [documentation](https://codefresh.io/docs/docs/administration/account-user-management/). + +## Example usage + +```hcl +resource "codefresh_account" "test" { + name = "my_account_name" + + limits { + collaborators = 25 + data_retention_weeks = 5 + } + + build { + parallel = 27 + } + + features = { + OfflineLogging = true, + ssoManagement = true, + teamsManagement = true, + abac = true, + customKubernetesCluster = true, + launchDarklyManagement = false, + } +} +``` + +{{ .SchemaMarkdown | trimspace }} + +## Import +```sh +terraform import codefresh_account.test xxxxxxxxxxxxxxxxxxx +``` \ No newline at end of file diff --git a/docs/resources/account-admins.md b/templates/resources/account_admins.md.tmpl similarity index 67% rename from docs/resources/account-admins.md rename to templates/resources/account_admins.md.tmpl index c6c763b2..d4cc50c1 100644 --- a/docs/resources/account-admins.md +++ b/templates/resources/account_admins.md.tmpl @@ -1,6 +1,13 @@ -# Account Admins resource +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- -Use this resource to set a list of admins for any account. +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} ## Example usage @@ -49,17 +56,10 @@ resource "codefresh_account_admins" "test" { } ``` -## Argument Reference - -- `account_id` - (Required) The account id where to set up a list of admins. -- `users` - (Required) A list of users to set up as account admins. - -## Attributes Reference - -- `id` - The Account ID. +{{ .SchemaMarkdown | trimspace }} ## Import ```sh terraform import codefresh_account_admins.test xxxxxxxxxxxxxxxxxxx -``` +``` \ No newline at end of file diff --git a/templates/resources/api_key.md.tmpl b/templates/resources/api_key.md.tmpl new file mode 100644 index 00000000..3ebc39c4 --- /dev/null +++ b/templates/resources/api_key.md.tmpl @@ -0,0 +1,75 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .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. + + + +## Example usage + +```hcl +provider "codefresh" { + api_url = "my API URL" + token = "my init API token" +} + +resource "codefresh_account" "test" { + name = "my new account" +} + +resource "random_string" "random" { + length = 16 + special = false +} + +resource "codefresh_api_key" "new" { + account_id = codefresh_account.test.id + user_id = data.codefresh_account.test_account_user.user_id + name = "tfkey_${random_string.random.result}" + + scopes = [ + "agent", + "agents", + "audit", + "build", + "cluster", + "clusters", + "environments-v2", + "github-action", + "helm", + "kubernetes", + "pipeline", + "project", + "repos", + "runner-installation", + "step-type", + "step-types", + "view", + "workflow", + ] +} + +provider "codefresh" { + alias = "new_account" + api_url = "my API URL" + token = codefresh_api_key.new.token +} + + +resource "codefresh_team" "team_1" { + + provider = codefresh.new_account + + name = "team name" +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/resources/context.md.tmpl b/templates/resources/context.md.tmpl new file mode 100644 index 00000000..c6f33257 --- /dev/null +++ b/templates/resources/context.md.tmpl @@ -0,0 +1,98 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Supported types + +There are multiple types of context available in Codefresh but they all have the following main components to define them: + +* `Name`: A unique identifier for the context +* `Type`: A string representing the type of context +* `Data`: A data structure that provide the information related to the Context. This differs based on the type of context selected +For more details of the Context spec see in the [CLI official documentation](https://codefresh-io.github.io/cli/contexts/spec/) + +Currently the provider supports the following types of Context: + +* `config` (Shared Config) +* `secret` (Shared Secret) +* `yaml` (YAML Configuration Context) +* `secret-yaml` (Secret YAML Configuration Context) + +### Shared Configuration +A Shared Configuration is the entity in Codefresh that allow to create values in a central place that can then be consumed in pipelines to keep them DRY. +More details in the official [Shared Configuration documentation](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/) + +### Example Usage + +#### Shared Config + +```hcl +resource "codefresh_context" "test-config" { + name = "my-shared-config" + spec { + config { + data = { + var1 = "value1" + var2 = "value2" + } + } + } +} +``` + +#### Shared Secret + +```hcl +resource "codefresh_context" "test-secret" { + name = "my-shared-secret" + spec { + secret { + data = { + var1 = "value1" + var2 = "value2" + } + } + } +} +``` + +#### YAML Configuration Context + +```hcl +resource "codefresh_context" "test-yaml" { + name = "my-shared-yaml" + spec { + # NOTE: you can also load the yaml from a file with `yaml = file("PATH-TO-FILE.yaml")` + yaml = < { + # some specific fields here + } + } +} +``` + +{{ .SchemaMarkdown | trimspace }} + +```sh +terraform import codefresh_registry.test xxxxxxxxxxxxxxxxxxx +``` \ No newline at end of file diff --git a/docs/resources/step-types.md b/templates/resources/step_types.md.tmpl similarity index 63% rename from docs/resources/step-types.md rename to templates/resources/step_types.md.tmpl index dcb81920..8c8619cb 100644 --- a/docs/resources/step-types.md +++ b/templates/resources/step_types.md.tmpl @@ -1,17 +1,27 @@ -# Step-types Resource +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} -The Step-types resource allows to create your own typed step and manage all it's published versions. -The resource allows to handle the life-cycle of the version by allowing specifying multiple blocks `version` where the user provides a version number and the yaml file representing the plugin. More about custom steps in the [official documentation](https://codefresh.io/docs/docs/codefresh-yaml/steps/#creating-a-typed-codefresh-plugin). ## Known limitations and disclaimers + ### Version and name in yaml Metadata are ignored. + The version and name of the step declared in the yaml files are superseeded by the attributes specified at resource level: - `name` : at top level - `version_numer`: specified in the `version` block The above are added/replaced at runtime time. ### Number of API requests + This resource makes a lot of additional API calls to validate the steps and retrieve all the version available. Caution is recommended on the amount of versions maintained and the number of resources defined in a single project. @@ -39,12 +49,4 @@ resource "codefresh_step_types_versions" "my-custom-step" { } ``` -## Argument Reference -- `name` - (Required) The name for the step-type -- `version` - (At least 1 Required) A collection of `version` blocks as documented below. - ---- - -`version` supports the following: -- `version_number` - (Required) String representing the semVer for the step -- `step_types_yaml` (Required) YAML String containing a valid definition of a typed plugin +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/team.md.tmpl b/templates/resources/team.md.tmpl new file mode 100644 index 00000000..b6a30d5e --- /dev/null +++ b/templates/resources/team.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +See the [documentation](https://codefresh.io/docs/docs/administration/access-control/). + +## Example usage + +```hcl +resource "codefresh_team" "developers" { + + name = "developers" + + users = [ + "5efc3cb6355c6647041b6e49", + "59009221c102763beda7cf04" + ] +} +``` + +{{ .SchemaMarkdown | trimspace }} \ No newline at end of file diff --git a/templates/resources/user.md.tmpl b/templates/resources/user.md.tmpl new file mode 100644 index 00000000..f6c46f42 --- /dev/null +++ b/templates/resources/user.md.tmpl @@ -0,0 +1,72 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + + + +## Example usage + +```hcl +resource "codefresh_account" "test" { + + name = "mynewaccount" + + limits { + collaborators = 25 + data_retention_weeks = 5 + } + + build { + parallel = 2 + } +} + +resource "codefresh_user" "new" { + email = "" + user_name = "" + + activate = true + + roles = [ + "Admin", + "User" + ] + + login { + idp_id = data.codefresh_idps.idp_azure.id + sso = true + } + + login { + idp_id = data.codefresh_idps.local.id + //sso = false + } + + + personal { + first_name = "John" + last_name = "Smith" + } + + accounts = [ + codefresh_account.test.id, + "59009117c102763beda7ce71", + ] +} +``` + +{{ .SchemaMarkdown | trimspace }} + +## Import + +```sh +terraform import codefresh_user.new xxxxxxxxxxxxxxxxxxx +``` + diff --git a/tf_modules/accounts_users/vars.tf b/tf_modules/accounts_users/vars.tf index 647ba4ca..41510ba1 100644 --- a/tf_modules/accounts_users/vars.tf +++ b/tf_modules/accounts_users/vars.tf @@ -38,43 +38,10 @@ variable default_idps { } } -# map of accounts indexed by unique account name -# accounts = { -# acc1 = { -# } -# acc2 = { -# limits = { -# collaborators = 50 -# parallel_builds = 5 -# } -# } -# } variable accounts { type = map(any) } -# map of users: -# users = { -# user1 = { -# email = "ddd@gmail.com" -# personal = { -# first_name = "Q" -# last_name = "D" -# } -# accounts = ["acc1", "acc2"] -# global_admin = false -# } -# user2 = { - -# email = "ddd@gmail.com" -# personal = { -# first_name = "Q" -# last_name = "D" -# } -# accounts = ["acc1", "acc2"] -# global_admin = true -# } -# } variable users { //type = map(any) } From 1ce55f39eb482db66104c1a57c16d0908e9d08ce Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Sun, 5 Mar 2023 23:35:44 +0200 Subject: [PATCH 2/9] Update contributing guide and README. --- CONTRIBUTING.md | 23 ++++++++++++++++++++++- README.md | 5 ++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index de455afe..a61e4b2d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,27 @@ ## Updating Provider Documentation +The documentation is generated using [tfplugindocs](https://github.com/hashicorp/terraform-plugin-docs). + +`docs/` should never be edited by hand. Instead, update the documentation via updating `Description` fields within the `schema` blocks of the provider's resources and data sources. And if needed, update the templates in `templates/`. Finally, you can run the following command to re-generate the documentation: + ```bash make docs -``` \ No newline at end of file +``` + +## Submitting a PR + +1. Fork the repo +2. Create a PR from your fork against the `master` branch +3. Add labels to your PR (see: [Labels](.github/release-drafter.yaml)) + +### PR Requirements + +1. Ensure that all tests pass (via commenting `/test` if you are an admin or a contributor with write access on this repo, otherwise wait for a maintainer to submit the comment. The comment will be ignored if you are not an admin or a contributor with write access on this repo. See: https://codefresh.io/docs/docs/pipelines/triggers/git-triggers/#support-for-building-pull-requests-from-forks) +2. Ensure that `make docs` has been run and committed. + +### Adding Yourself to the Contributors List + +Comment on the PR with `@all-contributors please add @ for ` and the bot will add you to the contributors list. See: [All Contributors](https://allcontributors.org/docs/en/bot/usage). + +For example: `@all-contributors please add @mitchellh for code`. \ No newline at end of file diff --git a/README.md b/README.md index 099e940d..3697345d 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,12 @@ terraform { ``` - ## [Documentation](./docs) +The documentation is generated using [tfplugindocs](https://github.com/hashicorp/terraform-plugin-docs). + +See: [CONTRIBUTING.md](./CONTRIBUTING.md#documentation) + ## [Examples](./examples) ## To configure Codefresh provider: From fb4956c09f9844aaa64c9e1e9f33a517c77a4706 Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Sun, 5 Mar 2023 23:41:47 +0200 Subject: [PATCH 3/9] Update README. --- README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3697345d..fe08ca78 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,12 @@ Terraform Registry: [registry.terraform.io/providers/codefresh-io/codefresh](htt ## Requirements -- [Terraform](https://www.terraform.io/downloads.html) `1.x.x` ; +- [Terraform](https://www.terraform.io/downloads.html) `1.x.x` ## Download the Provider Download and extract terraform-provider-codefresh from [releases](https://github.com/codefresh-io/terraform-provider-codefresh/releases) -## Building the Provider - -```sh -go build -o terraform-provider-codefresh -``` - ## Using the Provider In `versions.tf`: @@ -33,15 +27,18 @@ terraform { } ``` +## Building the Provider Locally -## [Documentation](./docs) +```sh +make install +``` + +## [Provider Documentation](./docs) The documentation is generated using [tfplugindocs](https://github.com/hashicorp/terraform-plugin-docs). See: [CONTRIBUTING.md](./CONTRIBUTING.md#documentation) -## [Examples](./examples) - ## To configure Codefresh provider: ```hcl @@ -67,6 +64,8 @@ export CODEFRESH_API_KEY='xyz' ## Testing the Provider +**NOTE:** Acceptance tests create real resources, including admin resources (accounts, users) so make sure that `CODEFRESH_API_KEY` is set to an account that you are ok with being modified. + ```bash make testacc ``` From c2f0350e5710baab111ef9999990e7ad3d710fd7 Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Sun, 5 Mar 2023 23:42:04 +0200 Subject: [PATCH 4/9] Update docs. --- docs/guides/development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/development.md b/docs/guides/development.md index 530c3f35..fbb3944a 100644 --- a/docs/guides/development.md +++ b/docs/guides/development.md @@ -7,7 +7,7 @@ It is possible that we will switch to the [Terraform Plugin Framework](https://g ### Prerequisites (other than Terraform) - GNU Make -- [Go](https://golang.org/doc/install) `1.18.x+` (minimum supported Go version required to build the provider). +- [Go](https://golang.org/doc/install) `1.(n-2).x` (minimum supported Go version required to build the provider; n is the latest minor version listed [here](https://go.dev/dl/)). ### Building and Running a Local Build of the Provider From 8ccc84cc76701fc8e9b13af21cad9b139febffa4 Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Sun, 5 Mar 2023 23:49:17 +0200 Subject: [PATCH 5/9] Add issue templates. --- .github/ISSUE_TEMPLATE.yaml | 62 ---------------------------- .github/ISSUE_TEMPLATES/bug.yaml | 30 ++++++++++++++ .github/ISSUE_TEMPLATES/feature.yaml | 17 ++++++++ 3 files changed, 47 insertions(+), 62 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.yaml create mode 100644 .github/ISSUE_TEMPLATES/bug.yaml create mode 100644 .github/ISSUE_TEMPLATES/feature.yaml diff --git a/.github/ISSUE_TEMPLATE.yaml b/.github/ISSUE_TEMPLATE.yaml deleted file mode 100644 index 9d0d058c..00000000 --- a/.github/ISSUE_TEMPLATE.yaml +++ /dev/null @@ -1,62 +0,0 @@ -name: Bug Report -description: File a bug report -title: "[Bug]: " -labels: ["bug", "triage"] -assignees: - - octocat -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! - - type: input - id: contact - attributes: - label: Contact Details - description: How can we get in touch with you if we need more info? - placeholder: ex. email@example.com - validations: - required: false - - type: textarea - id: what-happened - attributes: - label: What happened? - description: Also tell us, what did you expect to happen? - placeholder: Tell us what you see! - value: "A bug happened!" - validations: - required: true - - type: dropdown - id: version - attributes: - label: Version - description: What version of our software are you running? - options: - - 1.0.2 (Default) - - 1.0.3 (Edge) - validations: - required: true - - type: dropdown - id: browsers - attributes: - label: What browsers are you seeing the problem on? - multiple: true - options: - - Firefox - - Chrome - - Safari - - Microsoft Edge - - type: textarea - id: logs - attributes: - label: Relevant log output - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. - render: shell - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) - options: - - label: I agree to follow this project's Code of Conduct - required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATES/bug.yaml b/.github/ISSUE_TEMPLATES/bug.yaml new file mode 100644 index 00000000..3d24cb80 --- /dev/null +++ b/.github/ISSUE_TEMPLATES/bug.yaml @@ -0,0 +1,30 @@ +name: Bug Report +description: File a bug report +title: "[Bug]: " +labels: ["bug", "triage"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Describe the bug in detail. What did you expect to happen? What actually happened? + value: "A bug happened!" + validations: + required: true + - type: textarea + id: version + attributes: + label: Version + description: What version of the Provider are you running? + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant Terraform Configuration + description: Please copy and paste any relevant Terraform configurations we can use to reproduce the bug. + render: hcl diff --git a/.github/ISSUE_TEMPLATES/feature.yaml b/.github/ISSUE_TEMPLATES/feature.yaml new file mode 100644 index 00000000..939814ea --- /dev/null +++ b/.github/ISSUE_TEMPLATES/feature.yaml @@ -0,0 +1,17 @@ +name: Feature Request +description: Submit a feature request +title: "[Feature]: " +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this feature request! + - type: textarea + id: feature + attributes: + label: What would you like to be added? + description: If applicable, add a mock Terraform schema for the new resource or data source. + value: "The following feature would be great!" + validations: + required: true \ No newline at end of file From f672bdde2cd6b177dafd9b4458552c18adad239d Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Sun, 5 Mar 2023 23:53:42 +0200 Subject: [PATCH 6/9] Update labels. --- .github/labeler.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 58320d58..6127f00b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,20 +1,21 @@ source: -- 'client/**/*' -- 'codefresh/**/*' -- '*.go' -- '*.mod' -- '*.sum' + - "client/**/*" + - "codefresh/**/*" + - "*.go" + - "*.mod" + - "*.sum" docs: -- README.md -- docs/**/* -- examples/**/* -- tf_modules/**/* -- CHANGELOG.md + - README.md + - docs/**/* + - templates/**/* + - examples/**/* + - tf_modules/**/* + - CHANGELOG.md automation: -- scripts/**/* -- .github/**/* -- codefresh.yml -- .goreleaser.yml -- GNUmakefile + - scripts/**/* + - .github/**/* + - codefresh.yml + - .goreleaser.yml + - GNUmakefile From 014e02a774ec57af14888945b2ebd862ba6b341b Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Mon, 6 Mar 2023 00:03:14 +0200 Subject: [PATCH 7/9] go fmt. --- codefresh/resource_account_admins.go | 8 ++++---- codefresh/resource_registry.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/codefresh/resource_account_admins.go b/codefresh/resource_account_admins.go index 4dd05032..85342b8b 100644 --- a/codefresh/resource_account_admins.go +++ b/codefresh/resource_account_admins.go @@ -20,13 +20,13 @@ func resourceAccountAdmins() *schema.Resource { Schema: map[string]*schema.Schema{ "account_id": { Description: "The account id where to set up a list of admins.", - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, }, "users": { Description: "A list of users to set up as account admins.", - Type: schema.TypeSet, - Required: true, + Type: schema.TypeSet, + Required: true, Elem: &schema.Schema{ Type: schema.TypeString, }, diff --git a/codefresh/resource_registry.go b/codefresh/resource_registry.go index b62e4b90..25fef54a 100644 --- a/codefresh/resource_registry.go +++ b/codefresh/resource_registry.go @@ -290,10 +290,10 @@ func resourceRegistry() *schema.Resource { }, "behind_firewall": { Description: "See the [docs](https://codefresh.io/docs/docs/administration/behind-the-firewall/#accessing-an-internal-docker-registry).", - Type: schema.TypeBool, - Optional: true, - Default: false, - ForceNew: true, + Type: schema.TypeBool, + Optional: true, + Default: false, + ForceNew: true, }, }, }, From 5848f42e0734534742ec4d94ac12882138f2ad80 Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Mon, 6 Mar 2023 00:04:04 +0200 Subject: [PATCH 8/9] Update contributing guide and README. --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a61e4b2d..1d9011b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,8 @@ make docs ### PR Requirements 1. Ensure that all tests pass (via commenting `/test` if you are an admin or a contributor with write access on this repo, otherwise wait for a maintainer to submit the comment. The comment will be ignored if you are not an admin or a contributor with write access on this repo. See: https://codefresh.io/docs/docs/pipelines/triggers/git-triggers/#support-for-building-pull-requests-from-forks) -2. Ensure that `make docs` has been run and committed. +2. Ensure that `make docs` has been run and the changes have been committed. +3. Ensure that `make fmt` has been run and the changes have been committed. ### Adding Yourself to the Contributors List From 157b9c4d65a00182a1b4243e32be9ee072748fac Mon Sep 17 00:00:00 2001 From: Yonatan Koren <10080107+korenyoni@users.noreply.github.com> Date: Mon, 6 Mar 2023 10:59:29 +0200 Subject: [PATCH 9/9] Update tests. --- codefresh/resource_pipeline_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codefresh/resource_pipeline_test.go b/codefresh/resource_pipeline_test.go index 0f0e1515..04640bce 100644 --- a/codefresh/resource_pipeline_test.go +++ b/codefresh/resource_pipeline_test.go @@ -144,7 +144,7 @@ func TestAccCodefreshPipeline_Variables(t *testing.T) { func TestAccCodefreshPipeline_RuntimeEnvironment(t *testing.T) { name := pipelineNamePrefix + acctest.RandString(10) resourceName := "codefresh_pipeline.test" - runtimeName := "system/default-plan" + runtimeName := "system/default" var pipeline cfClient.Pipeline resource.ParallelTest(t, resource.TestCase{