Skip to content

auth-key sensitive+pipeline update + terr0.13 #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,32 @@ go build -o terraform-provider-codefresh

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 Linux OS it can be:

### 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/<OS_ARCH>
mkdir -p ${PLUGIN_DIR}
cp terraform-provider-codefresh ${PLUGIN_DIR}/
```

add [required_providers block](https://www.terraform.io/docs/configuration/provider-requirements.html#requiring-providers)
```terraform
terraform {

required_providers {
codefresh = {
versions = ["0.1.0"]
source = "codefresh.io/app/codefresh"
}
}
}
```


## [Documentations](./docs)

## [Examples](./examples)
Expand Down
1 change: 1 addition & 0 deletions codefresh/resource_api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func resourceApiKey() *schema.Resource {
"token": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
"scopes": {
Type: schema.TypeSet,
Expand Down
5 changes: 3 additions & 2 deletions codefresh/resource_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ func resourcePipeline() *schema.Resource {
},
"project_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,

},
"revision": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"tags": {
Type: schema.TypeSet,
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,11 @@ github.com/hashicorp/terraform-json v0.5.0/go.mod h1:eAbqb4w0pSlRmdvl8fOyHAi/+8j
github.com/hashicorp/terraform-plugin-sdk v1.7.0 h1:B//oq0ZORG+EkVrIJy0uPGSonvmXqxSzXe8+GhknoW0=
github.com/hashicorp/terraform-plugin-sdk v1.7.0/go.mod h1:OjgQmey5VxnPej/buEhe+YqKm0KNvV3QqU4hkqHqPCY=
github.com/hashicorp/terraform-plugin-sdk v1.15.0 h1:bmYnTT7MqNXlUHDc7pT8E6uKT2g/upjlRLypJFK1OQU=
github.com/hashicorp/terraform-plugin-sdk v1.16.0 h1:NrkXMRjHErUPPTHQkZ6JIn6bByiJzGnlJzH1rVdNEuE=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.0-rc.2 h1:HHppQ5ly03DFdZpuxiO2qHEbZ8uJHcZiRp37O9OfnCc=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.0-rc.2.0.20200717132200-7435e2abc9d1 h1:h8TtYDlIACXQ6LNJesvSHuxskaPUAX/nltvqp0Kp1vk=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.0-rc.2.0.20200717132200-7435e2abc9d1/go.mod h1:aWg/hVISyjdpUOt89SSrplxffuq8HPEnIWGyKDpDzCo=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.4 h1:GYkUL3zjrZgig9Gm+/61+YglzESJxXRDMp7qhJsh4j0=
github.com/hashicorp/terraform-plugin-test v1.2.0 h1:AWFdqyfnOj04sxTdaAF57QqvW7XXrT8PseUHkbKsE8I=
github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs=
github.com/hashicorp/terraform-plugin-test v1.4.4 h1:5Pvg9nESNFDnf6bafUYX5Qk15WaZtv0alxwOKiZo7vQ=
Expand Down
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import (

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")
if providerAddr == "" {
providerAddr = "registry.terraform.io/-/codefresh"
}
if debugMode {
err := plugin.Debug(context.Background(), "registry.terraform.io/-/codefresh",
err := plugin.Debug(context.Background(), providerAddr,
&plugin.ServeOpts{
ProviderFunc: codefresh.Provider,
})
Expand Down