Skip to content

Commit

Permalink
Merge pull request #16 from codefresh-io/CR-702-fixes
Browse files Browse the repository at this point in the history
auth-key sensitive+pipeline update + terr0.13
  • Loading branch information
kosta709 authored Oct 18, 2020
2 parents 267bd94 + 6e44ba5 commit a61a609
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
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

0 comments on commit a61a609

Please sign in to comment.