cloudflare_zero_trust_access_policy.tf.j2 917 B

123456789101112131415161718192021222324252627282930
  1. {% if service_token_enabled %}
  2. resource "cloudflare_zero_trust_access_policy" "{{ resource_name }}_service_token" {
  3. account_id = data.cloudflare_account.main.account_id
  4. name = "{{ service_token_policy_name }}"
  5. decision = "non_identity"
  6. include = [{
  7. service_token = {
  8. token_id = "{{ service_token_id }}"
  9. }
  10. }]
  11. session_duration = "{{ session_duration }}"
  12. }
  13. {% endif %}
  14. {% if ip_policy_enabled %}
  15. resource "cloudflare_zero_trust_access_policy" "{{ resource_name }}_ip" {
  16. account_id = data.cloudflare_account.main.account_id
  17. name = "{{ ip_policy_name }}"
  18. decision = "non_identity"
  19. include = [
  20. {% for ip_range in ip_ranges.split(',') %}
  21. {
  22. ip = {
  23. ip = "{{ ip_range.strip() }}"
  24. }
  25. }{{ "," if not loop.last else "" }}
  26. {% endfor %}
  27. ]
  28. session_duration = "{{ session_duration }}"
  29. }
  30. {% endif %}