|
9 | 9 |
|
10 | 10 | "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" |
11 | 11 | "github.com/hashicorp/terraform-plugin-framework/resource/schema" |
| 12 | + "github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault" |
12 | 13 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier" |
13 | 14 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" |
14 | 15 | "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" |
@@ -60,7 +61,7 @@ func connectionConfigSchemaAttribute() schema.Attribute { |
60 | 61 | "connection_name": schema.StringAttribute{ |
61 | 62 | MarkdownDescription: "The connection name of the Google Cloud SQL Postgresql instance. The `connection_name` format should be `<project>:<region>:<instance>`", |
62 | 63 | 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, |
64 | 65 | Validators: []validator.String{ |
65 | 66 | stringvalidator.RegexMatches(regexp.MustCompile(`^[a-z0-9\-]+\:[a-z0-9\-]+\:[a-z0-9\-]+$`), |
66 | 67 | "`connection_name` must have the format of `<project>:<region>:<instance>`"), |
@@ -100,16 +101,19 @@ func connectionConfigSchemaAttribute() schema.Attribute { |
100 | 101 | MarkdownDescription: "Use the private IP address of the Cloud SQL Postgresql instance to connect to", |
101 | 102 | Description: "Use the private IP address of the Cloud SQL Postgresql instance to connect to", |
102 | 103 | Optional: true, |
| 104 | + Default: booldefault.StaticBool(false), |
103 | 105 | }, |
104 | 106 | "psc": schema.BoolAttribute{ |
105 | 107 | MarkdownDescription: "Use the Private Service Connect endpoint of the Cloud SQL Postgresql instance to connect to", |
106 | 108 | Description: "Use the Private Service Connect endpoint of the Cloud SQL Postgresql instance to connect to", |
107 | 109 | Optional: true, |
| 110 | + Default: booldefault.StaticBool(false), |
108 | 111 | }, |
109 | 112 | "ssl_mode": schema.StringAttribute{ |
110 | 113 | MarkdownDescription: "Determine the security of the connection to the Cloud SQL Postgresql instance", |
111 | 114 | Description: "Determine the security of the connection to the Cloud SQL Postgresql instance", |
112 | 115 | Optional: true, |
| 116 | + Default: stringdefault.StaticString("disable"), |
113 | 117 | Validators: []validator.String{ |
114 | 118 | stringvalidator.RegexMatches(regexp.MustCompile(`^(disable|allow|prefer|require)$`), |
115 | 119 | "`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