Skip to content

Commit e58d029

Browse files
author
linyus
committed
fix:postgresql root user setting support
1 parent c086982 commit e58d029

File tree

8 files changed

+212
-63
lines changed

8 files changed

+212
-63
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ terraform-provider-qcloud
1515
terraform.tfstate
1616
terraform.tfstate.backup
1717
terraform.tfstate.lock.info
18+
dist/
19+
gendoc/gendoc

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
## 1.56.16 (Unreleased)
1+
## 1.57.2 (Aug 7, 2021)
2+
3+
ENHANCEMENTS:
4+
5+
* Resource `tencentcloud_postgresql_instance` root_user setting support
6+
7+
## 1.57.1 (Aug 5, 2021)
8+
9+
ENHANCEMENTS:
10+
11+
* Resource `tencentcloud_vpn_gateway_route` add example docs
12+
13+
## 1.57.0 (July 28, 2021)
14+
15+
FEATURES:
16+
17+
* **New Resource**: `tencentcloud_vpn_gateway_route`
18+
* **New Data Source**: `tencentcloud_vpn_gateway_route`
219

320
## 1.56.15 (July 07, 2021)
421

examples/tencentcloud-postgresql/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ resource "tencentcloud_postgresql_instance" "example" {
1818
vpc_id = tencentcloud_vpc.foo.id
1919
subnet_id = tencentcloud_subnet.foo.id
2020
engine_version = "9.3.5"
21+
root_user = "root"
2122
root_password = "1qaA2k1wgvfa3ZZZ"
2223
charset = "UTF8"
2324
project_id = 0

tencentcloud/data_source_tc_postgresql_instances.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ func dataSourceTencentCloudPostgresqlInstances() *schema.Resource {
113113
Computed: true,
114114
Description: "Availability zone.",
115115
},
116+
"root_user": {
117+
Type: schema.TypeString,
118+
Computed: true,
119+
Description: "Instance root account name, default value is `root`.",
120+
},
116121
"public_access_switch": {
117122
Type: schema.TypeBool,
118123
Computed: true,
@@ -210,6 +215,15 @@ func dataSourceTencentCloudPostgresqlInstanceRead(d *schema.ResourceData, meta i
210215
listItem["charset"] = v.DBCharset
211216
listItem["public_access_host"] = ""
212217

218+
// rootUser
219+
accounts, outErr := service.DescribeRootUser(ctx, d.Id())
220+
if outErr != nil {
221+
return outErr
222+
}
223+
if len(accounts) > 0 {
224+
listItem["root_user"] = accounts[0].UserName
225+
}
226+
213227
for _, netInfo := range v.DBInstanceNetInfo {
214228
if *netInfo.NetType == "public" {
215229
if *netInfo.Status == "opened" || *netInfo.Status == "1" {

0 commit comments

Comments
 (0)