> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/networking/appsec-aws-216.md).

# AWS Cloudfront distribution is disabled misconfiguration detected in code

## Rule Details

|                        |                                  |
| ---------------------- | -------------------------------- |
| Cortex AppSec Rule ID  | APPSEC\_AWS\_216                 |
| Category - Subcategory | Public Exposure - Load Balancing |
| Provider               | AWS                              |
| Severity               | LOW                              |
| Framework              | Terraform                        |

## Impact

When a CloudFront distribution is enabled, it will continue to incur charges for data transfer and requests, even if it is not being used by your application. Disabling the distribution can help to reduce these costs. In addition, leaving an unused CloudFront distribution enabled can also pose a security risk, as it may be vulnerable to attack or misuse. Disabling the distribution can help to mitigate these risks. However, it is important to note that disabling a CloudFront distribution may cause any applications or websites that rely on it to become unavailable.

## How to Fix

## \[source,go]

resource "aws\_cloudfront\_distribution" "pass" { dynamic "origin" { for\_each = local.origins content { domain\_name = origin.value\["domain\_name"] origin\_id = origin.value\["origin\_id"]

s3\_origin\_config { origin\_access\_identity = origin.value\["origin\_access\_identity"] } } }

enabled = true is\_ipv6\_enabled = true default\_root\_object = "index.html"

default\_cache\_behavior { allowed\_methods = var.default\_behaviour.allowed\_methods cached\_methods = var.default\_behaviour.cached\_methods target\_origin\_id = var.default\_behaviour.origin\_id

forwarded\_values { query\_string = var.default\_behaviour.query\_string

cookies { forward = var.default\_behaviour.forward } }

viewer\_protocol\_policy = "allow-all" min\_ttl = var.default\_behaviour.min\_ttl default\_ttl = var.default\_behaviour.default\_ttl max\_ttl = var.default\_behaviour.max\_ttl }

dynamic "ordered\_cache\_behavior" { for\_each = var.behaviours content { path\_pattern = ordered\_cache\_behavior.value\["path\_pattern"] allowed\_methods = ordered\_cache\_behavior.value\["allowed\_methods"] cached\_methods = ordered\_cache\_behavior.value\["cached\_methods"] target\_origin\_id = ordered\_cache\_behavior.value\["origin\_id"] forwarded\_values { headers = ordered\_cache\_behavior.value\["headers"] query\_string = ordered\_cache\_behavior.value\["query\_string"] cookies { forward = ordered\_cache\_behavior.value\["forward"] } } min\_ttl = ordered\_cache\_behavior.value\["min\_ttl"] default\_ttl = ordered\_cache\_behavior.value\["default\_ttl"] max\_ttl = ordered\_cache\_behavior.value\["max\_ttl"] compress = ordered\_cache\_behavior.value\["compress"] viewer\_protocol\_policy = "allow-all" } }

price\_class = "PriceClass\_200"

restrictions { geo\_restriction { restriction\_type = var.geo\_restrictions\["restriction\_type"] locations = var.geo\_restrictions\["locations"] } }

viewer\_certificate { cloudfront\_default\_certificate = var.viewer\_certificate\["cloudfront\_default\_certificate"] minimum\_protocol\_version = var.viewer\_certificate\["minimum\_protocol\_version"] }

## lifecycle { ignore\_changes = \[tags] } tags = { "key" = "value" } }


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/appsec-rules/iac-security/networking/appsec-aws-216.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
