Skip to content

Commit fb3bb7d

Browse files
authored
Create main.tf
Add PITR Terraform code samples for Cloud SQL for SQL Server.
1 parent 3205350 commit fb3bb7d

File tree

1 file changed

+57
-0
lines changed
  • cloud_sql/sqlserver_instance_pitr

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# [START cloud_sql_sqlserver_instance_enterprise_plus_pitr]
18+
# Creates a SQL SERVER Enterprise Plus edition instance. Unless specified otherwise, PITR is enabled by default.
19+
resource "google_sql_database_instance" "default" {
20+
name = "sqlserver-enterprise-plus-instance-pitr"
21+
region = "asia-northeast1"
22+
database_version = "SQLSERVER_2019_ENTERPRISE"
23+
settings {
24+
tier = "db-perf-optimized-N-2"
25+
edition = "ENTERPRISE_PLUS"
26+
backup_configuration {
27+
enabled = true
28+
}
29+
}
30+
# Setting the `deletion_protection` flag to true ensures you can't accidentally delete the instance
31+
# using Terraform. Setting the `deletion_protection_enabled` flag to true protects the instance at the
32+
# Google Cloud level.
33+
deletion_protection = false
34+
}
35+
# [END cloud_sql_sqlserver_instance_pitr]
36+
37+
# [START cloud_sql_sqlserver_instance_enterprise_pitr]
38+
# Creates a SQL SERVER Enterprise edition instance with PITR enabled. Unless specified otherwise,
39+
# PITR is disabled by default.
40+
resource "google_sql_database_instance" "default" {
41+
name = "sqlserver-enterprise-instance-pitr"
42+
region = "asia-northeast1"
43+
database_version = "SQLSERVER_2019_ENTERPRISE"
44+
settings {
45+
tier = "db-custom-4-26624"
46+
edition = "ENTERPRISE_PLUS"
47+
backup_configuration {
48+
enabled = true
49+
point_in_time_recovery_enabled = true
50+
}
51+
}
52+
# Setting the `deletion_protection` flag to true ensures you can't accidentally delete the instance
53+
# using Terraform. Setting the `deletion_protection_enabled` flag to true protects the instance at the
54+
# Google Cloud level.
55+
deletion_protection = false
56+
}
57+
# [END cloud_sql_sqlserver_instance_update_pitr]

0 commit comments

Comments
 (0)