Schedule GitHub action workflow for specific time (UTC based)
Download Terraform
Extract zip file
→ run terraform.exe
check terraform version
Download terraform code from here
Create Account on Terraform cloud
Click on Free Account
Verify email address
Create Organization
Create API- Driven Workspace
Add Details
Work Space Created
Go to variable Section add digital Ocean Token according name in main.tf
go to settings
Select auto apply & save settings
Generate API Token
click on above link
create user token
Copy and save the token
Copy workspace id
Add this secrets in GitHub actions
ORG_NAME = “organization name of terraform cloud”
TERRAFORM_API_TOKEN = ”Token of Terraform cloud”
TF_VAR_DIGITALOCEAN_TOKEN = “digital ocean token”
WORKSPACE_ID =” workspace id “
WORKSPACE_NAME = “ name of workspace”
Workflow file
schedule based on UTC time period
Go to this website for utc time conversion → Go to this website for cronjob expression →
Uncomment this part in workflow file to schedule GitHub action
Example
in above screenshot 5:56 is UTC time
make cronjob expression for it
Type like below screenshot
schedule:
- cron: '56 5* * *' # Schedule for 11:26 AM daily
Run Terraform cloud Locally
In terminal Configure Terraform Cloud
terraform init -reconfigure
Add Yes in Terminal
Add token in terminal
Plan terraform
Apply Terraform
Single Project → Multiple Environment (Workspace)
API - DRIVEN WorkFlow
Stage Branch Workspace Created
We need this to connect to our Workspace
Add Variables