3 – Configure HTTPS settings
After setting up basic DNS records, you can configure zone settings using Terraform. This tutorial shows how to enable TLS 1.3, Automatic HTTPS Rewrites, and Strict SSL mode using the updated v5 provider.
- Completed tutorials 1 and 2
- Valid SSL certificate on your origin server (use the Cloudflare Origin CA to generate one for strict SSL mode)
Create a new branch and add zone settings:
git checkout -b step3-zone-setings
Add the following to your main.tf
file:
# Enable TLS 1.3resource "cloudflare_zone_setting" "tls_1_3" { zone_id = var.zone_id setting_id = "tls_1_3" value = "on"}
# Enable automatic HTTPS rewritesresource "cloudflare_zone_setting" "automatic_https_rewrites" { zone_id = var.zone_id setting_id = "automatic_https_rewrites" value = "on"}
# Set SSL mode to strictresource "cloudflare_zone_setting" "ssl" { zone_id = var.zone_id setting_id = "ssl" value = "strict"}
Review the proposed changes:
terraform plan
Expected output
Plan: 3 to add, 0 to change, 0 to destroy.
Terraform will perform the following actions:
# cloudflare_zone_setting.automatic_https_rewrites will be created + resource "cloudflare_zone_setting" "automatic_https_rewrites" { + setting_id = "automatic_https_rewrites" + value = "on" + zone_id = "your-zone-id" }
# cloudflare_zone_setting.ssl will be created + resource "cloudflare_zone_setting" "ssl" { + setting_id = "ssl" + value = "strict" + zone_id = "your-zone-id" }
# cloudflare_zone_setting.tls_1_3 will be created + resource "cloudflare_zone_setting" "tls_1_3" { + setting_id = "tls_1_3" + value = "on" + zone_id = "your-zone-id" }
Commit and merge the changes:
git add main.tfgit commit -m "Enable TLS 1.3, automatic HTTPS rewrites, and strict SSL"git checkout maingit merge step3-zone-settingsgit push
Before applying the changes, try to connect with TLS 1.3. Technically, you should not be able to with default settings. To follow along with this test, you will need to compile curl
against BoringSSL ↗.
curl -v --tlsv1.3 https://www.example.com 2>&1 | grep "SSL connection\|error"
As shown above, you should receive an error because TLS 1.3 is not yet enabled on your zone. Enable it by running terraform apply
and try again.
Apply the configuration:
terraform apply
Type yes
when prompted.
Try the same command as before. The command will now succeed.
curl -v --tlsv1.3 https://www.example.com 2>&1 | grep "SSL connection\|error"
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark