Skip to content

Commit

Permalink
fixing id
Browse files Browse the repository at this point in the history
  • Loading branch information
fceller committed Mar 16, 2022
1 parent 91d91e6 commit 20b06f5
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ planfile*
*.tfplan*
*backend.config
errored.tfstate
*.idea
*.idea
*~
60 changes: 60 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
set -e

# define architecture we want to build
ARCH=${ARCH:-"amd64 arm64"}
OS=${OS:-linux darwin}
TAG=${TAG:-0.0.0}

# clean up
echo "Running clean up..."
rm -rf output
rm -rf artifacts

if test -n "${DEST}"; then
dest=`realpath ${DEST}`
fi

# build
# we want to build statically linked binaries
export CGO_ENABLED=0
echo -n "Building... "

for os in ${OS}; do
for arch in ${ARCH}; do
echo -n "${os}_${arch} "
env GOOS=${os} GOARCH=${arch} go build -o "output/terraform-provider-zoom_${TAG}_${os}_${arch}/terraform-provider-zoom_${TAG}"
cp README.md output/terraform-provider-zoom_${TAG}_${os}_${arch}
# cp LICENSE output/terraform-provider-zoom_${TAG}_${os}_${arch}


if test -n "${dest}"; then
mkdir -p "${dest}/.terraform.d/plugins/local/fceller/zoom/${TAG}/${os}_${arch}"
cp \
"output/terraform-provider-zoom_${TAG}_${os}_${arch}/terraform-provider-zoom_${TAG}" \
"${dest}/.terraform.d/plugins/local/fceller/zoom/${TAG}/${os}_${arch}/terraform-provider-zoom"
fi
done
done
echo

# Zip and copy to the dist dir
echo -n "Packaging... "
mkdir artifacts

for PLATFORM in $(find ./output -mindepth 1 -maxdepth 1 -type d); do
OSARCH=$(basename ${PLATFORM})
echo -n "${OSARCH} "

pushd output/${OSARCH} >/dev/null 2>&1
zip ../../artifacts/${OSARCH}.zip *
popd >/dev/null 2>&1

pushd artifacts >/dev/null 2>&1
shasum -a 256 ${OSARCH}.zip >> terraform-provider-zoom_${TAG}_SHA256SUMS
popd >/dev/null 2>&1
done

pushd artifacts >/dev/null 2>&1
gpg --detach-sign terraform-provider-zoom_${TAG}_SHA256SUMS
popd >/dev/null 2>&1
7 changes: 7 additions & 0 deletions zoom/resource_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func resourceUser() *schema.Resource {
StateContext: resourceUserImporter,
},
Schema: map[string]*schema.Schema{
"id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"email": &schema.Schema{
Type: schema.TypeString,
Required: true,
Expand Down Expand Up @@ -201,6 +206,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, m interface
return diag.FromErr(retryErr)
}
d.SetId(id)
d.Set("email", user.Email)
resourceUserRead(ctx, d, m)
return diags
}
Expand Down Expand Up @@ -472,6 +478,7 @@ func resourceUserImporter(ctx context.Context, d *schema.ResourceData, m interfa
}
return resource.NonRetryableError(err)
}
d.SetId(user.Id)
d.Set("id", user.Id)
d.Set("first_name", user.FirstName)
d.Set("last_name", user.LastName)
Expand Down

0 comments on commit 20b06f5

Please sign in to comment.