File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ package postgresql
2
+
3
+ import (
4
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
5
+ )
6
+
7
+ func dataSourcePostgrePassword () * schema.Resource {
8
+ return & schema.Resource {
9
+ Read : dataSourcePostgrePasswordRead ,
10
+ Schema : map [string ]* schema.Schema {
11
+ "password" : {
12
+ Type : schema .TypeString ,
13
+ Computed : true ,
14
+ },
15
+ },
16
+ }
17
+ }
18
+
19
+ func dataSourcePostgrePasswordRead (d * schema.ResourceData , meta interface {}) error {
20
+ client := meta .(* Client )
21
+ d .SetId ("password" )
22
+ d .Set ("password" , client .config .Password )
23
+ return nil
24
+ }
Original file line number Diff line number Diff line change @@ -175,6 +175,10 @@ func Provider() *schema.Provider {
175
175
"postgresql_function" : resourcePostgreSQLFunction (),
176
176
},
177
177
178
+ DataSourcesMap : map [string ]* schema.Resource {
179
+ "postgresql_password" : dataSourcePostgrePassword (),
180
+ },
181
+
178
182
ConfigureFunc : providerConfigure ,
179
183
}
180
184
}
Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : " postgresql"
3
+ page_title : " PostgreSQL: postgresql_password"
4
+ sidebar_current : " docs-postgresql-datasource-postgresql_password"
5
+ description : |-
6
+ Retrieve the postgres password generated by IAM Authentication
7
+ ---
8
+
9
+ # postgresql\_ password
10
+
11
+ The `` postgresql_password `` data source can be used to retrieve the password
12
+ generated by IAM Authentication for any other usage.
13
+
14
+ ## Usage
15
+
16
+ ``` hcl
17
+ data "postgresql_password" "my_password" {
18
+ }
19
+ ```
20
+
21
+ ## Attributes Reference
22
+
23
+ * ` password ` - The password generated by IAM Authentication (or the password provided by the user)
Original file line number Diff line number Diff line change 45
45
</ li >
46
46
</ ul >
47
47
</ li >
48
+
49
+ < li <%= sidebar_current ( "docs-postgresql-datasource" ) %> >
50
+ < a href ="# "> Data Sources</ a >
51
+ < ul class ="nav nav-visible ">
52
+ < li <%= sidebar_current ( "docs-postgresql-datasource-postgresql_password" ) %> >
53
+ < a href ="/docs/providers/postgresql/d/postgresql_password.html "> postgresql_password</ a >
54
+ </ li >
55
+ </ ul >
56
+ </ li >
48
57
</ ul >
49
58
</ div >
50
59
<% end %>
You can’t perform that action at this time.
0 commit comments