Skip to content

Commit 7e8c8f5

Browse files
author
Abdelkarim Boujida
committed
some default values
1 parent 3060c80 commit 7e8c8f5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

internal/provider/connection_config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
1111
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
12+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
1213
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
1314
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
1415
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
@@ -60,7 +61,7 @@ func connectionConfigSchemaAttribute() schema.Attribute {
6061
"connection_name": schema.StringAttribute{
6162
MarkdownDescription: "The connection name of the Google Cloud SQL Postgresql instance. The `connection_name` format should be `<project>:<region>:<instance>`",
6263
Description: "The connection name of the Google Cloud SQL Postgresql instance. The connection_name format should be <project>:<region>:<instance>",
63-
Optional: true,
64+
Required: true,
6465
Validators: []validator.String{
6566
stringvalidator.RegexMatches(regexp.MustCompile(`^[a-z0-9\-]+\:[a-z0-9\-]+\:[a-z0-9\-]+$`),
6667
"`connection_name` must have the format of `<project>:<region>:<instance>`"),
@@ -100,16 +101,19 @@ func connectionConfigSchemaAttribute() schema.Attribute {
100101
MarkdownDescription: "Use the private IP address of the Cloud SQL Postgresql instance to connect to",
101102
Description: "Use the private IP address of the Cloud SQL Postgresql instance to connect to",
102103
Optional: true,
104+
Default: booldefault.StaticBool(false),
103105
},
104106
"psc": schema.BoolAttribute{
105107
MarkdownDescription: "Use the Private Service Connect endpoint of the Cloud SQL Postgresql instance to connect to",
106108
Description: "Use the Private Service Connect endpoint of the Cloud SQL Postgresql instance to connect to",
107109
Optional: true,
110+
Default: booldefault.StaticBool(false),
108111
},
109112
"ssl_mode": schema.StringAttribute{
110113
MarkdownDescription: "Determine the security of the connection to the Cloud SQL Postgresql instance",
111114
Description: "Determine the security of the connection to the Cloud SQL Postgresql instance",
112115
Optional: true,
116+
Default: stringdefault.StaticString("disable"),
113117
Validators: []validator.String{
114118
stringvalidator.RegexMatches(regexp.MustCompile(`^(disable|allow|prefer|require)$`),
115119
"`ssl_mode` must be a supported ssl mode. One of 'disable', 'allow', 'prefer' or 'require'"), // TODO: add support for verify-ca and verify-full

0 commit comments

Comments
 (0)