Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose additional fields in resource_sql_source_representation_instance #3724

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions google-beta/resource_sql_source_representation_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,44 @@ func resourceSQLSourceRepresentationInstance() *schema.Resource {
Defaults to 3306.`,
Default: 3306,
},
"username": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The username for connecting to on-premises instance.`,
},
"password": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Sensitive: true,
Description: `The password for connecting to on-premises instance.`,
},
"ca_certificate": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `PEM representation of the trusted CA's x509 certificate.`,
},
"client_certificate": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `PEM representation of the replica's x509 certificate.`,
},
"client_key": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Sensitive: true,
Description: `PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate.`,
},
"dump_file_path": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The dump file to create the Cloud SQL replica.`,
},

"region": {
Type: schema.TypeString,
Expand Down Expand Up @@ -340,6 +378,18 @@ func flattenSQLSourceRepresentationInstanceOnPremisesConfiguration(v interface{}
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationHost(original["host"], d, config)
transformed["port"] =
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationPort(original["port"], d, config)
transformed["username"] =
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationUsername(original["username"], d, config)
transformed["password"] =
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationPassword(original["password"], d, config)
transformed["ca_certificate"] =
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationCaCertificate(original["ca_certificate"], d, config)
transformed["client_certificate"] =
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationClientCertificate(original["client_certificate"], d, config)
transformed["client_key"] =
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationClientKey(original["client_key"], d, config)
transformed["dump_file_path"] =
flattenSQLSourceRepresentationInstanceOnPremisesConfigurationDumpFilePath(original["dump_file_path"], d, config)
return []interface{}{transformed}
}
func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationHost(v interface{}, d *schema.ResourceData, config *Config) interface{} {
Expand All @@ -363,6 +413,30 @@ func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationPort(v interfa
return v // let terraform core handle it otherwise
}

func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationUsername(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationPassword(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationCaCertificate(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationClientCertificate(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationClientKey(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenSQLSourceRepresentationInstanceOnPremisesConfigurationDumpFilePath(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func expandSQLSourceRepresentationInstanceName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Expand Down Expand Up @@ -402,6 +476,30 @@ func expandSQLSourceRepresentationInstanceOnPremisesConfigurationPort(v interfac
return v, nil
}

func expandSQLSourceRepresentationInstanceOnPremisesConfigurationUsername(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandSQLSourceRepresentationInstanceOnPremisesConfigurationPassword(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandSQLSourceRepresentationInstanceOnPremisesConfigurationCaCertificate(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandSQLSourceRepresentationInstanceOnPremisesConfigurationClientCertificate(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandSQLSourceRepresentationInstanceOnPremisesConfigurationClientKey(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandSQLSourceRepresentationInstanceOnPremisesConfigurationDumpFilePath(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func resourceSQLSourceRepresentationInstanceEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) {
opc := obj["onPremisesConfiguration"].(map[string]interface{})
opc["hostPort"] = fmt.Sprintf("%v:%v", opc["host"], opc["port"])
Expand Down