Skip to content

Commit c08c455

Browse files
committed
Apply consistent documentation and naming to existing singular datasources
1 parent 47e4fae commit c08c455

20 files changed

+173
-192
lines changed

docs/core/instance_credentials.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1-
# oci_core_instance_credential
1+
# oci_core_instance_credentials
2+
3+
## InstanceCredential Singular DataSource
4+
5+
### InstanceCredential Reference
6+
7+
The following attributes are exported:
8+
9+
* `password` - The password for the username.
10+
* `username` - The username.
211

3-
## InstanceCredential DataSource
412

5-
Gets a single instance_credential
613

714
### Get Operation
815
Gets the generated credentials for the instance. Only works for Windows instances. The returned credentials
916
are only valid for the initial login.
1017

18+
1119
The following arguments are supported:
1220

1321
* `instance_id` - (Required) The OCID of the instance.
1422

1523

16-
The following attributes are exported:
17-
18-
* `password` - The password for the username.
19-
* `username` - The username.
20-
2124
### Example Usage
2225

2326
```hcl
24-
data "oci_core_instance_credentials" "test_instance_credentials" {
27+
data "oci_core_instance_credentials" "test_instance_credential" {
2528
#Required
2629
instance_id = "${oci_core_instance.test_instance.id}"
2730
}
28-
```
31+
```
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
# oci_core_ipsec_config
22

3-
## IpSecConnectionDeviceConfig DataSource
4-
5-
Gets a single ip_sec_connection_device_config
6-
7-
### Get Operation
8-
Gets the configuration information for the specified IPSec connection. For each tunnel, the
9-
response includes the IP address of Oracle's VPN headend and the shared secret.
10-
11-
The following arguments are supported:
12-
13-
* `ipsec_id` - (Required) The OCID of the IPSec connection.
3+
## IpSecConnectionDeviceConfig Singular DataSource
144

5+
### IpSecConnectionDeviceConfig Reference
156

167
The following attributes are exported:
178

@@ -21,14 +12,25 @@ The following attributes are exported:
2112
* `tunnels` - Two [TunnelConfig](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/TunnelConfig/) objects.
2213
* `ip_address` - The IP address of Oracle's VPN headend. Example: `129.146.17.50`
2314
* `shared_secret` - The shared secret of the IPSec tunnel. Example: `vFG2IF6TWq4UToUiLSRDoJEUs6j1c.p8G.dVQxiMfMO0yXMLi.lZTbYIWhGu4V8o`
24-
* `time_created` - The date and time the IPSec connection was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
15+
* `time_created` - The date and time the IPSec connection was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
16+
17+
18+
19+
### Get Operation
20+
Gets the configuration information for the specified IPSec connection. For each tunnel, the
21+
response includes the IP address of Oracle's VPN headend and the shared secret.
22+
23+
24+
The following arguments are supported:
25+
26+
* `ipsec_id` - (Required) The OCID of the IPSec connection.
2527

2628

2729
### Example Usage
2830

2931
```hcl
30-
data "oci_core_ipsec_config" "test_ip_sec_connection_device_configs" {
32+
data "oci_core_ipsec_config" "test_ip_sec_connection_device_config" {
3133
#Required
3234
ipsec_id = "${oci_core_ipsec.test_ipsec.id}"
3335
}
34-
```
36+
```
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
# oci_core_ipsec_status
22

3-
## IpSecConnectionDeviceStatus DataSource
4-
5-
Gets a list of ip_sec_connection_device_status.
6-
7-
### Get Operation
8-
Gets the status of the specified IPSec connection (whether it's up or down).
9-
10-
The following arguments are supported:
11-
12-
* `ipsec_id` - (Required) The OCID of the IPSec connection.
3+
## IpSecConnectionDeviceStatus Singular DataSource
134

5+
### IpSecConnectionDeviceStatus Reference
146

157
The following attributes are exported:
168

@@ -20,8 +12,18 @@ The following attributes are exported:
2012
* `tunnels` - Two [TunnelStatus](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/TunnelStatus/) objects.
2113
* `ip_address` - The IP address of Oracle's VPN headend. Example: `129.146.17.50`
2214
* `state` - The tunnel's current state.
23-
* `time_created` - The date and time the IPSec connection was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
24-
* `time_state_modified` - When the state of the tunnel last changed, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
15+
* `time_created` - The date and time the IPSec connection was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
16+
* `time_state_modified` - When the state of the tunnel last changed, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
17+
18+
19+
20+
### Get Operation
21+
Gets the status of the specified IPSec connection (whether it's up or down).
22+
23+
24+
The following arguments are supported:
25+
26+
* `ipsec_id` - (Required) The OCID of the IPSec connection.
2527

2628

2729
### Example Usage
@@ -31,4 +33,4 @@ data "oci_core_ipsec_status" "test_ip_sec_connection_device_status" {
3133
#Required
3234
ipsec_id = "${oci_core_ipsec.test_ipsec.id}"
3335
}
34-
```
36+
```

docs/core/vnics.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
# oci_core_vnic
22

3-
## Vnic DataSource
4-
5-
Gets a single VNIC
6-
7-
### Get Operation
8-
Gets the information for the specified virtual network interface card (VNIC).
9-
You can get the VNIC OCID from the
10-
[ListVnicAttachments](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/ListVnicAttachments)
11-
operation.
12-
13-
The following arguments are supported:
14-
15-
* `vnic_id` - (Required) The OCID of the VNIC.
3+
## Vnic Singular DataSource
164

5+
### Vnic Reference
176

187
The following attributes are exported:
198

@@ -34,11 +23,24 @@ The following attributes are exported:
3423
* `time_created` - The date and time the VNIC was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
3524

3625

26+
27+
### Get Operation
28+
Gets the information for the specified virtual network interface card (VNIC).
29+
You can get the VNIC OCID from the
30+
[ListVnicAttachments](https://docs.us-phoenix-1.oraclecloud.com/api/#/en/iaas/20160918/VnicAttachment/ListVnicAttachments)
31+
operation.
32+
33+
34+
The following arguments are supported:
35+
36+
* `vnic_id` - (Required) The OCID of the VNIC.
37+
38+
3739
### Example Usage
3840

3941
```hcl
4042
data "oci_core_vnic" "test_vnic" {
4143
#Required
4244
vnic_id = "${oci_core_vnic.test_vnic.id}"
4345
}
44-
```
46+
```

docs/identity/tenancies.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
1+
# oci_identity_tenancy
12

2-
# oci_identity_tenancies
3-
4-
## Tenancy DataSource
5-
6-
Gets a single tenancy
7-
8-
### Get Operation
9-
Get the specified tenancy's information.
10-
The following arguments are supported:
11-
12-
* `tenancy_id` - (Required) The OCID of the tenancy.
3+
## Tenancy Singular DataSource
134

5+
### Tenancy Reference
146

157
The following attributes are exported:
168

179
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
1810
* `description` - The description of the tenancy.
1911
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
2012
* `home_region_key` - The region key for the tenancy's home region. For more information about regions, see [Regions and Availability Domains](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). Allowed values are: - `IAD` - `PHX` - `FRA` - `LHR`
21-
* `tenancy_id` - The OCID of the tenancy.
13+
* `id` - The OCID of the tenancy.
2214
* `name` - The name of the tenancy.
2315

2416

17+
18+
### Get Operation
19+
Get the specified tenancy's information.
20+
21+
The following arguments are supported:
22+
23+
* `tenancy_id` - (Required) The OCID of the tenancy.
24+
25+
2526
### Example Usage
2627

2728
```hcl
28-
data "oci_identity_tenancies" "test_tenancies" {
29+
data "oci_identity_tenancy" "test_tenancy" {
2930
#Required
3031
tenancy_id = "${var.tenancy_ocid}"
3132
}
3233
```
33-
### Tenancy Reference
34-
35-
The following attributes are exported:
36-
37-
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
38-
* `description` - The description of the tenancy.
39-
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
40-
* `home_region_key` - The region key for the tenancy's home region. For more information about regions, see [Regions and Availability Domains](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). Allowed values are: - `IAD` - `PHX` - `FRA` - `LHR`
41-
* `tenancy_id` - The OCID of the tenancy.
42-
* `name` - The name of the tenancy.

docs/object_storage/namespaces.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
21
# oci_objectstorage_namespace
32

4-
## Namespace DataSource
3+
## Namespace Singular DataSource
4+
5+
### Namespace Reference
6+
7+
The following attributes are exported:
8+
9+
* `namespace` - (Computed) The name of the user's namespace.
10+
511

6-
Gets a namespace
712

813
### Get Operation
914
Gets the name of the namespace for the user making the request. An account name must be unique, must start with a
1015
letter, and can have up to 15 lowercase letters and numbers. You cannot use spaces or special characters.
1116

17+
1218
The following arguments are supported:
1319

1420
* No arguments are necessary
1521

16-
The following attributes are exported:
17-
18-
* `namespace` - (Computed) The name of the user's namespace.
1922

2023
### Example Usage
2124

provider/core_instance_credentials_data_source.go renamed to provider/core_instance_credential_data_source.go

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,46 @@ import (
1111
"github.com/oracle/terraform-provider-oci/crud"
1212
)
1313

14-
func InstanceCredentialsDataSource() *schema.Resource {
14+
func InstanceCredentialDataSource() *schema.Resource {
1515
return &schema.Resource{
16-
Read: readInstanceCredentials,
16+
Read: readSingularInstanceCredential,
1717
Schema: map[string]*schema.Schema{
18-
// InstanceCredentials is a single-value data source.
1918
"instance_id": {
2019
Type: schema.TypeString,
2120
Required: true,
2221
},
23-
"username": {
22+
// Computed
23+
"password": {
2424
Type: schema.TypeString,
2525
Computed: true,
2626
},
27-
"password": {
27+
"username": {
2828
Type: schema.TypeString,
2929
Computed: true,
3030
},
3131
},
3232
}
3333
}
3434

35-
func readInstanceCredentials(d *schema.ResourceData, m interface{}) error {
36-
sync := &InstanceCredentialsDataSourceCrud{}
35+
func readSingularInstanceCredential(d *schema.ResourceData, m interface{}) error {
36+
sync := &InstanceCredentialDataSourceCrud{}
3737
sync.D = d
3838
sync.Client = m.(*OracleClients).computeClient
3939

4040
return crud.ReadResource(sync)
4141
}
4242

43-
type InstanceCredentialsDataSourceCrud struct {
44-
crud.BaseCrud
43+
type InstanceCredentialDataSourceCrud struct {
44+
D *schema.ResourceData
4545
Client *oci_core.ComputeClient
4646
Res *oci_core.GetWindowsInstanceInitialCredentialsResponse
4747
}
4848

49-
func (s *InstanceCredentialsDataSourceCrud) Get() error {
49+
func (s *InstanceCredentialDataSourceCrud) VoidState() {
50+
s.D.SetId("")
51+
}
52+
53+
func (s *InstanceCredentialDataSourceCrud) Get() error {
5054
request := oci_core.GetWindowsInstanceInitialCredentialsRequest{}
5155

5256
if instanceId, ok := s.D.GetOkExists("instance_id"); ok {
@@ -65,7 +69,7 @@ func (s *InstanceCredentialsDataSourceCrud) Get() error {
6569
return nil
6670
}
6771

68-
func (s *InstanceCredentialsDataSourceCrud) SetData() {
72+
func (s *InstanceCredentialDataSourceCrud) SetData() {
6973
if s.Res == nil {
7074
return
7175
}

provider/core_instance_credential_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ func TestCoreInstanceCredentialResource_basic(t *testing.T) {
2828
compartmentId := getRequiredEnvSetting("compartment_ocid")
2929
compartmentIdVariableStr := fmt.Sprintf("variable \"compartment_id\" { default = \"%s\" }\n", compartmentId)
3030

31-
datasourceName := "data.oci_core_instance_credentials.test_instance_credentials"
31+
singularDatasourceName := "data.oci_core_instance_credentials.test_instance_credentials"
3232

3333
resource.Test(t, resource.TestCase{
3434
Providers: map[string]terraform.ResourceProvider{
3535
"oci": provider,
3636
},
3737
Steps: []resource.TestStep{
38-
// verify datasource
38+
// verify singular datasource
3939
{
4040
Config: config + `
4141
@@ -45,12 +45,10 @@ data "oci_core_instance_credentials" "test_instance_credentials" {
4545
}
4646
` + compartmentIdVariableStr + InstanceCredentialResourceConfig,
4747
Check: resource.ComposeAggregateTestCheckFunc(
48-
resource.TestCheckResourceAttrSet(datasourceName, "instance_id"),
48+
resource.TestCheckResourceAttrSet(singularDatasourceName, "instance_id"),
4949

50-
resource.TestCheckResourceAttrSet(datasourceName, "instance_credentials.#"),
51-
resource.TestCheckResourceAttrSet(datasourceName, "instance_credentials.0.instance_id"),
52-
resource.TestCheckResourceAttrSet(datasourceName, "instance_credentials.0.password"),
53-
resource.TestCheckResourceAttrSet(datasourceName, "instance_credentials.0.username"),
50+
resource.TestCheckResourceAttrSet(singularDatasourceName, "password"),
51+
resource.TestCheckResourceAttrSet(singularDatasourceName, "username"),
5452
),
5553
},
5654
},

0 commit comments

Comments
 (0)