Skip to content

Commit 23b194d

Browse files
Promote CDN Policies to GA (#4914) (#3381)
Co-authored-by: upodroid <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: upodroid <[email protected]>
1 parent 051e9e2 commit 23b194d

7 files changed

+44
-39
lines changed

.changelog/4914.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
compute: promoted all `cdn_policy` sub fields in `google_compute_backend_service`, `google_compute_region_backend_service` and `google_compute_backend_bucket` to GA
3+
```

google-beta/resource_compute_backend_bucket_generated_test.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,27 @@ func TestAccComputeBackendBucket_backendBucketFullExample(t *testing.T) {
7272

7373
vcrTest(t, resource.TestCase{
7474
PreCheck: func() { testAccPreCheck(t) },
75-
Providers: testAccProvidersOiCS,
75+
Providers: testAccProviders,
7676
CheckDestroy: testAccCheckComputeBackendBucketDestroyProducer(t),
7777
Steps: []resource.TestStep{
7878
{
7979
Config: testAccComputeBackendBucket_backendBucketFullExample(context),
8080
},
81+
{
82+
ResourceName: "google_compute_backend_bucket.image_backend_full",
83+
ImportState: true,
84+
ImportStateVerify: true,
85+
},
8186
},
8287
})
8388
}
8489

8590
func testAccComputeBackendBucket_backendBucketFullExample(context map[string]interface{}) string {
8691
return Nprintf(`
87-
resource "google_compute_backend_bucket" "image_backend" {
92+
resource "google_compute_backend_bucket" "image_backend_full" {
8893
name = "tf-test-image-backend-bucket-full%{random_suffix}"
8994
description = "Contains beautiful beta mages"
90-
bucket_name = google_storage_bucket.image_bucket.name
95+
bucket_name = google_storage_bucket.image_backend_full.name
9196
enable_cdn = true
9297
cdn_policy {
9398
cache_mode = "CACHE_ALL_STATIC"
@@ -102,7 +107,7 @@ resource "google_compute_backend_bucket" "image_backend" {
102107
]
103108
}
104109
105-
resource "google_storage_bucket" "image_bucket" {
110+
resource "google_storage_bucket" "image_backend_full" {
106111
name = "tf-test-image-store-bucket-full%{random_suffix}"
107112
location = "EU"
108113
}

google-beta/resource_compute_backend_service_generated_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,24 @@ func TestAccComputeBackendService_backendServiceCacheExample(t *testing.T) {
116116

117117
vcrTest(t, resource.TestCase{
118118
PreCheck: func() { testAccPreCheck(t) },
119-
Providers: testAccProvidersOiCS,
119+
Providers: testAccProviders,
120120
CheckDestroy: testAccCheckComputeBackendServiceDestroyProducer(t),
121121
Steps: []resource.TestStep{
122122
{
123123
Config: testAccComputeBackendService_backendServiceCacheExample(context),
124124
},
125+
{
126+
ResourceName: "google_compute_backend_service.default",
127+
ImportState: true,
128+
ImportStateVerify: true,
129+
},
125130
},
126131
})
127132
}
128133

129134
func testAccComputeBackendService_backendServiceCacheExample(context map[string]interface{}) string {
130135
return Nprintf(`
131136
resource "google_compute_backend_service" "default" {
132-
provider = google-beta
133137
name = "tf-test-backend-service%{random_suffix}"
134138
health_checks = [google_compute_http_health_check.default.id]
135139
enable_cdn = true
@@ -144,7 +148,6 @@ resource "google_compute_backend_service" "default" {
144148
}
145149
146150
resource "google_compute_http_health_check" "default" {
147-
provider = google-beta
148151
name = "tf-test-health-check%{random_suffix}"
149152
request_path = "/"
150153
check_interval_sec = 1

google-beta/resource_compute_region_backend_service_generated_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func TestAccComputeRegionBackendService_regionBackendServiceCacheExample(t *test
9292
func testAccComputeRegionBackendService_regionBackendServiceCacheExample(context map[string]interface{}) string {
9393
return Nprintf(`
9494
resource "google_compute_region_backend_service" "default" {
95-
provider = google-beta
9695
name = "tf-test-region-service%{random_suffix}"
9796
region = "us-central1"
9897
health_checks = [google_compute_region_health_check.default.id]
@@ -112,7 +111,6 @@ resource "google_compute_region_backend_service" "default" {
112111
}
113112
114113
resource "google_compute_region_health_check" "default" {
115-
provider = google-beta
116114
name = "tf-test-rbs-health-check%{random_suffix}"
117115
region = "us-central1"
118116

website/docs/r/compute_backend_bucket.html.markdown

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,48 +119,48 @@ The `cdn_policy` block supports:
119119
header. The actual headers served in responses will not be altered.
120120

121121
* `default_ttl` -
122-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
122+
(Optional)
123123
Specifies the default TTL for cached content served by this origin for responses
124124
that do not have an existing valid TTL (max-age or s-max-age).
125125

126126
* `max_ttl` -
127-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
127+
(Optional)
128128
Specifies the maximum allowed TTL for cached content served by this origin.
129129

130130
* `client_ttl` -
131-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
131+
(Optional)
132132
Specifies the maximum allowed TTL for cached content served by this origin.
133133

134134
* `negative_caching` -
135-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
135+
(Optional)
136136
Negative caching allows per-status code TTLs to be set, in order to apply fine-grained caching for common errors or redirects.
137137

138138
* `negative_caching_policy` -
139-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
139+
(Optional)
140140
Sets a cache TTL for the specified HTTP status code. negativeCaching must be enabled to configure negativeCachingPolicy.
141141
Omitting the policy and leaving negativeCaching enabled will use Cloud CDN's default cache TTLs.
142142
Structure is documented below.
143143

144144
* `cache_mode` -
145-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
145+
(Optional)
146146
Specifies the cache setting for all responses from this backend.
147147
The possible values are: USE_ORIGIN_HEADERS, FORCE_CACHE_ALL and CACHE_ALL_STATIC
148148
Possible values are `USE_ORIGIN_HEADERS`, `FORCE_CACHE_ALL`, and `CACHE_ALL_STATIC`.
149149

150150
* `serve_while_stale` -
151-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
151+
(Optional)
152152
Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache.
153153

154154

155155
The `negative_caching_policy` block supports:
156156

157157
* `code` -
158-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
158+
(Optional)
159159
The HTTP status code to define a TTL against. Only HTTP status codes 300, 301, 308, 404, 405, 410, 421, 451 and 501
160160
can be specified as values, and you cannot specify a status code more than once.
161161

162162
* `ttl` -
163-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
163+
(Optional)
164164
The TTL (in seconds) for which to cache responses with the corresponding status code. The maximum allowed value is 1800s
165165
(30 minutes), noting that infrequently accessed objects may be evicted from the cache before the defined TTL.
166166

website/docs/r/compute_backend_service.html.markdown

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ resource "google_compute_http_health_check" "default" {
9696

9797
```hcl
9898
resource "google_compute_backend_service" "default" {
99-
provider = google-beta
10099
name = "backend-service"
101100
health_checks = [google_compute_http_health_check.default.id]
102101
enable_cdn = true
@@ -111,7 +110,6 @@ resource "google_compute_backend_service" "default" {
111110
}
112111
113112
resource "google_compute_http_health_check" "default" {
114-
provider = google-beta
115113
name = "health-check"
116114
request_path = "/"
117115
check_interval_sec = 1
@@ -615,36 +613,36 @@ The `cdn_policy` block supports:
615613
responses will not be altered.
616614

617615
* `default_ttl` -
618-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
616+
(Optional)
619617
Specifies the default TTL for cached content served by this origin for responses
620618
that do not have an existing valid TTL (max-age or s-max-age).
621619

622620
* `max_ttl` -
623-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
621+
(Optional)
624622
Specifies the maximum allowed TTL for cached content served by this origin.
625623

626624
* `client_ttl` -
627-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
625+
(Optional)
628626
Specifies the maximum allowed TTL for cached content served by this origin.
629627

630628
* `negative_caching` -
631-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
629+
(Optional)
632630
Negative caching allows per-status code TTLs to be set, in order to apply fine-grained caching for common errors or redirects.
633631

634632
* `negative_caching_policy` -
635-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
633+
(Optional)
636634
Sets a cache TTL for the specified HTTP status code. negativeCaching must be enabled to configure negativeCachingPolicy.
637635
Omitting the policy and leaving negativeCaching enabled will use Cloud CDN's default cache TTLs.
638636
Structure is documented below.
639637

640638
* `cache_mode` -
641-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
639+
(Optional)
642640
Specifies the cache setting for all responses from this backend.
643641
The possible values are: USE_ORIGIN_HEADERS, FORCE_CACHE_ALL and CACHE_ALL_STATIC
644642
Possible values are `USE_ORIGIN_HEADERS`, `FORCE_CACHE_ALL`, and `CACHE_ALL_STATIC`.
645643

646644
* `serve_while_stale` -
647-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
645+
(Optional)
648646
Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache.
649647

650648

@@ -686,12 +684,12 @@ The `cache_key_policy` block supports:
686684
The `negative_caching_policy` block supports:
687685

688686
* `code` -
689-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
687+
(Optional)
690688
The HTTP status code to define a TTL against. Only HTTP status codes 300, 301, 308, 404, 405, 410, 421, 451 and 501
691689
can be specified as values, and you cannot specify a status code more than once.
692690

693691
* `ttl` -
694-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
692+
(Optional)
695693
The TTL (in seconds) for which to cache responses with the corresponding status code. The maximum allowed value is 1800s
696694
(30 minutes), noting that infrequently accessed objects may be evicted from the cache before the defined TTL.
697695

website/docs/r/compute_region_backend_service.html.markdown

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ resource "google_compute_health_check" "default" {
7070

7171
```hcl
7272
resource "google_compute_region_backend_service" "default" {
73-
provider = google-beta
7473
name = "region-service"
7574
region = "us-central1"
7675
health_checks = [google_compute_region_health_check.default.id]
@@ -90,7 +89,6 @@ resource "google_compute_region_backend_service" "default" {
9089
}
9190
9291
resource "google_compute_region_health_check" "default" {
93-
provider = google-beta
9492
name = "rbs-health-check"
9593
region = "us-central1"
9694
@@ -680,36 +678,36 @@ The `cdn_policy` block supports:
680678
responses will not be altered.
681679

682680
* `default_ttl` -
683-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
681+
(Optional)
684682
Specifies the default TTL for cached content served by this origin for responses
685683
that do not have an existing valid TTL (max-age or s-max-age).
686684

687685
* `max_ttl` -
688-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
686+
(Optional)
689687
Specifies the maximum allowed TTL for cached content served by this origin.
690688

691689
* `client_ttl` -
692-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
690+
(Optional)
693691
Specifies the maximum allowed TTL for cached content served by this origin.
694692

695693
* `negative_caching` -
696-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
694+
(Optional)
697695
Negative caching allows per-status code TTLs to be set, in order to apply fine-grained caching for common errors or redirects.
698696

699697
* `negative_caching_policy` -
700-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
698+
(Optional)
701699
Sets a cache TTL for the specified HTTP status code. negativeCaching must be enabled to configure negativeCachingPolicy.
702700
Omitting the policy and leaving negativeCaching enabled will use Cloud CDN's default cache TTLs.
703701
Structure is documented below.
704702

705703
* `cache_mode` -
706-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
704+
(Optional)
707705
Specifies the cache setting for all responses from this backend.
708706
The possible values are: USE_ORIGIN_HEADERS, FORCE_CACHE_ALL and CACHE_ALL_STATIC
709707
Possible values are `USE_ORIGIN_HEADERS`, `FORCE_CACHE_ALL`, and `CACHE_ALL_STATIC`.
710708

711709
* `serve_while_stale` -
712-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
710+
(Optional)
713711
Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache.
714712

715713

@@ -751,7 +749,7 @@ The `cache_key_policy` block supports:
751749
The `negative_caching_policy` block supports:
752750

753751
* `code` -
754-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
752+
(Optional)
755753
The HTTP status code to define a TTL against. Only HTTP status codes 300, 301, 308, 404, 405, 410, 421, 451 and 501
756754
can be specified as values, and you cannot specify a status code more than once.
757755

0 commit comments

Comments
 (0)