This terraform provider allows to perform Create ,Read ,Update, Delete, Import and Deactivate Zoom User(s).
❗ [IMPORTANT] : This provider can only be successfully tested on a premium paid zoom account.
- Create a zoom account with paid subscription (PRO Plan/Business Account). (https://zoom.us/)
- Sign in to the zoom account.
- Go to Zoom Marketplace
- Click on
Build App
. For our purpose we need to make a JWT App. - Follow this Create JWT Zoom App website to make an app.
This app will provide us with the API Secret, API Key, and token which will be needed to configure our provider and make request.
- Clone the repository to $GOPATH/src/github.com/zoom/terraform-provider-zoom
- Add the API Secret, API Key generated in the JWT Zoom App to respective fields in
main.tf
- Run the following command :
go mod init terraform-provider-zoom
go mod tidy
- Run
go mod vendor
to create a vendor directory that contains all the provider's dependencies.
- Run the following command to create a vendor subdirectory which will comprise of all provider dependencies.
~/.terraform.d/plugins/${host_name}/${namespace}/${type}/${version}/${target}
Command:
mkdir -p ~/.terraform.d/plugins/hashicorp.com/edu/zoom/0.2.0/[OS_ARCH]
For eg. mkdir -p ~/.terraform.d/plugins/hashicorp.com/edu/zoom/0.2.0/windows_amd64
- Run
go build -o terraform-provider-zoom.exe
. This will save the binary (.exe
) file in the main/root directory. - Run this command to move this binary file to appropriate location.
move terraform-provider-zoom.exe %APPDATA%\terraform.d\plugins\hashicorp.com\edu\zoom\0.2.0\[OS_ARCH]
Otherwise you can manually move the file from current directory to destination directory.
[OR]
- Download required binaries
- move binary
~/.terraform.d/plugins/[architecture name]/
- Add the user email, first name, last name, status, license_type,deartment,job_title,location in the respective field in
main.tf
- set API_SECRET and API_KEY.
- Initialize the terraform provider
terraform init
- Check the changes applicable using
terraform plan
and apply usingterraform apply
- You will see that a user has been successfully created and an account activation mail has been sent to the user.
- Activate the account using the link provided in the mail.
Update the data of the user in the main.tf
file and apply using terraform apply
Add data and output blocks in the main.tf
file and run terraform plan
to read user data
Change the status of User from activate
to deactivate
or viceversa anf run terraform apply
.
Delete the resource block of the particular user from main.tf
file and run terraform apply
.
- Write manually a resource configuration block for the User in
main.tf
, to which the imported object will be mapped. - Run the command
terraform import zoom_user.user1 [EMAIL_ID]
- Check for the attributes in the
.tfstate
file and fill them accordingly in resource block.
- Navigate to the test file directory.
- Run command
go test
. This command will give combined test result for the execution or errors if any failure occur. - If you want to see test result of each test function individually while running test in a single go, run command
go test -v
- To check test cover run
go test -cover
terraform {
required_providers {
zoom = {
version = "0.2"
source = "hashicorp.com/edu/zoom"
}
}
}
provider "zoom" {
apikey = ""
apisecret = ""
}
resource "zoom_user" "user1" {
email = "[EMAIL_ID]"
first_name = "[USER_FIRST_NAME]"
last_name = "[USER_LAST_NAME]"
status = "activate"
license_type = [INTEGER VALUE]
department = "[USER_DEPARTMENT]"
job_title = "[USER_JOB_TITLE]"
location = "[USER_LOCATION]"
}
data "zoom_user" "user1" {
id = "[EMAIL_ID]"
}
output "user1" {
value = data.zoom_user.user1
}
apikey
(Required,string) - The Zoom API Keyapisecret
(Required,string) - The Zoom API Secretemail
(Required,string) - The email id associated with the user account.first_name
(Required,string) - First name of the User.last_name
(Required,string) - Last Name / Family Name / Surname of the User.status
(Optional,string) - User account activation status ie.(activate,deactivate).license_type
(Required,integer) - User account type ie.(1=Basic, 2=License, 3=On-prem)job_title
(Optional,string) - Job title of the particular user.department
(Optional,string) - Department of the particular user.location
(Optional,string) - Department of the particular user.id
(Computed,string) - Unique ID of the User which is same as Email ID.pmi
(Computed,integer) - Generated pmi no of the user.role_name
(Computed,string) - Current role of the user ie.(Admin,Member).