Skip to content

Commit 1e54fcb

Browse files
committed
Tidy up a few points of feedback - thanks @rberlind
1 parent f53b814 commit 1e54fcb

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test.log
66
terraform.tfstate
77
terraform.tfstate.backup
88
crash.log
9-
examples/terrform*
9+
examples/terraform*
1010
**/github_api_token
1111
**/release_info.md
1212
scripts/terraform-provider-restapi*

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Have a look at the [examples directory](examples) for some use cases
2222
- `insecure` (boolean, optional): When using https, this disables TLS verification of the host.
2323
- `username` (string, optional): When set, will use this username for BASIC auth to the API.
2424
- `password` (string, optional): When set, will use this password for BASIC auth to the API.
25-
- `headers` (hash of strings, optional): A map of header names and values to set on all outbound requests. This is useful if you want to use a script via the 'external' provider or provide a pre-approved token. If `username` and `password` are set and Authorization is one of the headers defined here, the BASIC auth credentials take precedence.
25+
- `headers` (hash of strings, optional): A map of header names and values to set on all outbound requests. This is useful if you want to use a script via the 'external' provider or provide a pre-approved token or change Content-Type from `application/json`. If `username` and `password` are set and Authorization is one of the headers defined here, the BASIC auth credentials take precedence.
2626
- `timeout` (integer, optional): When set, will cause requests taking longer than this time (in seconds) to be aborted. Default is `0` which means no timeout is set.
2727
- `id_attribute` (string, optional): When set, this key will be used to operate on REST objects. For example, if the ID is set to 'name', changes to the API object will be to `http://foo.com/bar/VALUE_OF_NAME`.
2828
- `copy_keys` (array of strings, optional): When set, any `PUT` to the API for an object will copy these keys from the data the provider has gathered about the object. This is useful if internal API information must also be provided with updates, such as the revision of the object.
@@ -59,4 +59,4 @@ This provider also exports the following parameters:
5959
## Installation
6060
There are two standard methods of installing this provider detailed [in Terraform's documentation](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins). You can place the file in the directory of your .tf file in `terraform.d/plugins/{OS}_{ARCH}/` or place it in your home directory at `~/.terraform.d/plugins/{OS}_{ARCH}/`
6161

62-
The released binaries are named `terraform-provider-restapi-vX.Y.Z-{OS}-{ARCH}` so you know which binary to install. Be sure to rename the binary you use during installation to just `terraform-provider-restapi-vX.Y.Z`.
62+
The released binaries are named `terraform-provider-restapi_vX.Y.Z-{OS}-{ARCH}` so you know which binary to install. You *may* need to rename the binary you use during installation to just `terraform-provider-restapi_vX.Y.Z`.

restapi/provider.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func Provider() terraform.ResourceProvider {
3636
Type: schema.TypeMap,
3737
Elem: schema.TypeString,
3838
Optional: true,
39-
Description: "A map of header names and values to set on all outbound requests. This is useful if you want to use a script via the 'external' provider or provide a pre-approved token. If `username` and `password` are set and Authorization is one of the headers defined here, the BASIC auth credentials take precedence.",
39+
Description: "A map of header names and values to set on all outbound requests. This is useful if you want to use a script via the 'external' provider or provide a pre-approved token or change Content-Type from `application/json`. If `username` and `password` are set and Authorization is one of the headers defined here, the BASIC auth credentials take precedence.",
4040
},
4141
"timeout": &schema.Schema{
4242
Type: schema.TypeInt,

scripts/create-github-release.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,13 @@ if [[ ! -f release_info.md ]];then
6767
fi
6868

6969
release_info=$(cat release_info.md)
70-
set +e
71-
read -r -d '' RELEASE_JSON <<EOF
72-
{
73-
"tag_name": "$tag",
74-
"name": "$tag",
75-
"body": "$release_info",
76-
"draft": $draft
77-
}
78-
EOF
79-
set -e
70+
JSON_STRING=$(jq --arg notes "$release_info"
71+
RELEASE_JSON=$(jq -n \
72+
--arg tag "$tag" \
73+
--arg name "$tag" \
74+
--arg body "$release_info" \
75+
'{ "tag_name": $tag, "name": $name, "body": $body, "draft": '$draft'}'
76+
)
8077
8178
# Send the data
8279
response=$(curl -sH "$AUTH" "$GH_REPO/releases" -X POST -d "$RELEASE_JSON")

scripts/do_release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if [[ -z "$github_api_token" || -z "$owner" || -z "$repo" || -z "$tag" ]];then
2626
exit 1
2727
fi
2828

29-
if [[ "$tag" != "v*" ]];then
29+
if [[ "$tag" != v* ]];then
3030
tag="v$tag"
3131
fi
3232

@@ -44,7 +44,7 @@ for GOOS in darwin linux windows;do
4444
for GOARCH in "386" amd64;do
4545
export GOOS GOARCH
4646

47-
TF_OUT_FILE="terraform-provider-restapi-$tag-$GOOS-$GOARCH"
47+
TF_OUT_FILE="terraform-provider-restapi_$tag-$GOOS-$GOARCH"
4848
echo " $TF_OUT_FILE"
4949
go build -o "$TF_OUT_FILE" ../
5050
ARTIFACTS+=("$TF_OUT_FILE")

0 commit comments

Comments
 (0)