Skip to content

Commit f988ef8

Browse files
rebecca-peteglasnt
authored andcommitted
feat(cloud_sql): Add Cloud SQL Server PITR (terraform-google-modules#812)
* Create main.tf Add PITR Terraform code samples for Cloud SQL for SQL Server. * terraform fmt * correct region tags * ensure unique resource names * Update main.tf Update edition for the Enterprise sample. * Update main.tf Updated editions for samples. * Update tier for enterprise plus * revert tier change * Add `root_password` argument --------- Co-authored-by: Katie McLaughlin <[email protected]>
1 parent 8e52559 commit f988ef8

File tree

1 file changed

+59
-0
lines changed
  • cloud_sql/sqlserver_instance_pitr

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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" "enterprise_plus" {
20+
name = "sqlserver-enterprise-plus-instance-pitr"
21+
region = "asia-northeast1"
22+
database_version = "SQLSERVER_2019_ENTERPRISE"
23+
root_password = "INSERT-PASSWORD-HERE"
24+
settings {
25+
tier = "db-perf-optimized-N-2"
26+
edition = "ENTERPRISE_PLUS"
27+
backup_configuration {
28+
enabled = true
29+
}
30+
}
31+
# Setting the `deletion_protection` flag to true ensures you can't accidentally delete the instance
32+
# using Terraform. Setting the `deletion_protection_enabled` flag to true protects the instance at the
33+
# Google Cloud level.
34+
deletion_protection = false
35+
}
36+
# [END cloud_sql_sqlserver_instance_enterprise_plus_pitr]
37+
38+
# [START cloud_sql_sqlserver_instance_enterprise_pitr]
39+
# Creates a SQL SERVER Enterprise edition instance with PITR enabled. Unless specified otherwise,
40+
# PITR is disabled by default.
41+
resource "google_sql_database_instance" "enterprise" {
42+
name = "sqlserver-enterprise-instance-pitr"
43+
region = "asia-northeast1"
44+
database_version = "SQLSERVER_2019_ENTERPRISE"
45+
root_password = "INSERT-PASSWORD-HERE"
46+
settings {
47+
tier = "db-custom-4-26624"
48+
edition = "ENTERPRISE"
49+
backup_configuration {
50+
enabled = true
51+
point_in_time_recovery_enabled = true
52+
}
53+
}
54+
# Setting the `deletion_protection` flag to true ensures you can't accidentally delete the instance
55+
# using Terraform. Setting the `deletion_protection_enabled` flag to true protects the instance at the
56+
# Google Cloud level.
57+
deletion_protection = false
58+
}
59+
# [END cloud_sql_sqlserver_instance_enterprise_pitr]

0 commit comments

Comments
 (0)