Skip to content

Commit

Permalink
review optional + computed in cdn (#26535)
Browse files Browse the repository at this point in the history
  • Loading branch information
catriona-m authored Jul 5, 2024
1 parent cd0fcf9 commit b7e25e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions internal/services/cdn/cdn_endpoint_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/migration"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cdn/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
Expand Down Expand Up @@ -119,7 +120,7 @@ func resourceCdnEndpoint() *pluginsdk.Resource {
"origin_path": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Computed: !features.FourPointOhBeta(),
},

"querystring_caching_behaviour": {
Expand All @@ -137,7 +138,7 @@ func resourceCdnEndpoint() *pluginsdk.Resource {
"content_types_to_compress": {
Type: pluginsdk.TypeSet,
Optional: true,
Computed: true,
Computed: !features.FourPointOhBeta(),
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
Expand All @@ -152,7 +153,7 @@ func resourceCdnEndpoint() *pluginsdk.Resource {
"probe_path": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
Computed: !features.FourPointOhBeta(),
},

"geo_filter": {
Expand Down
4 changes: 2 additions & 2 deletions internal/services/cdn/cdn_endpoint_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestAccCdnEndpoint_fullFields(t *testing.T) {
check.That(data.ResourceName).Key("origin_host_header").HasValue("www.contoso.com"),
check.That(data.ResourceName).Key("optimization_type").HasValue("GeneralWebDelivery"),
check.That(data.ResourceName).Key("querystring_caching_behaviour").HasValue("UseQueryString"),
check.That(data.ResourceName).Key("content_types_to_compress.#").HasValue("1"),
check.That(data.ResourceName).Key("content_types_to_compress.#").HasValue("3"),
check.That(data.ResourceName).Key("is_compression_enabled").HasValue("true"),
check.That(data.ResourceName).Key("geo_filter.#").HasValue("1"),
check.That(data.ResourceName).Key("tags.%").HasValue("1"),
Expand Down Expand Up @@ -723,7 +723,7 @@ resource "azurerm_cdn_endpoint" "test" {
resource_group_name = azurerm_resource_group.test.name
is_http_allowed = true
is_https_allowed = true
content_types_to_compress = ["text/html"]
content_types_to_compress = ["text/html", "image/gif", "text/css"]
is_compression_enabled = true
querystring_caching_behaviour = "UseQueryString"
origin_host_header = "www.contoso.com"
Expand Down

0 comments on commit b7e25e9

Please sign in to comment.