You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
oci session authenticate #authenticate and create a profile "terraform"
terraform init
# for dev environment
terraform workspace new dev
terraform workspace selectdev# for prod environment
terraform workspace new prod
terraform workspace selectprod# for getting a general compute instance(ubuntu)
terraform apply
# cleanup
terraform destroy
# for converting the created instance into nixos directly, creating ansible inventory file with terraform and Dynamically update DNS records at NameCheap
terraform apply '-var=setup=true''-var=rebuild=true''-var=nixos_flake=github:<username>/<repo>/<branch>#<machine>''-var=ddns=true''-var=namecheap_api_key=<namecheap_api_key>''-var=domain=<domain>''-var=subdomains="*,@"'# Run solo modules
terraform apply -target=module.ansible #First step always as rest use the inventory.ini file generated as config
terraform apply -target=module.setup '-var=setup=true'# Note for below to work you will have to enable Dynamic DNS at NameCheap and create the "*,@" subdomains as 'A + Dynamic DNS Record'
terraform apply -target=module.ddns '-var=ddns=true''-var=namecheap_api_key=<namecheap_api_key>''-var=domain=<domain>''-var=subdomains="*,@"'# For rebuilding
terraform apply -target=module.rebuild '-var=rebuild=true''-var=nixos_flake=github:<username>/<repo>/<branch>#<machine>'#Can be used by OCI auth may timeout if it takes time# Better approach
nixos-rebuild --target-host root@<instance_ip> switch --flake 'github:<username>/<repo>/<branch>#<machine>' --fast --impure --refresh
Configuration
Modify terraform.tfvars and variables.tf files as per the need/account
Create terraform.tfvars file in root of the project with following config