-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[upstream:67774938b12e510a6a705cc5c0cf4f897f27f464] Signed-off-by: Modular Magician <magic-modules@google.com>
- Loading branch information
1 parent
e65430e
commit f841671
Showing
5 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-datasource | ||
`google_oracle_database_cloud_vm_cluster` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
google/services/oracledatabase/data_source_oracle_database_cloud_vm_cluster.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
package oracledatabase | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/hashicorp/terraform-provider-google/google/tpgresource" | ||
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" | ||
) | ||
|
||
func DataSourceOracleDatabaseCloudVmCluster() *schema.Resource { | ||
dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(ResourceOracleDatabaseCloudVmCluster().Schema) | ||
tpgresource.AddRequiredFieldsToSchema(dsSchema, "location", "cloud_vm_cluster_id") | ||
tpgresource.AddOptionalFieldsToSchema(dsSchema, "project") | ||
return &schema.Resource{ | ||
Read: dataSourceOracleDatabaseCloudVmClusterRead, | ||
Schema: dsSchema, | ||
} | ||
|
||
} | ||
|
||
func dataSourceOracleDatabaseCloudVmClusterRead(d *schema.ResourceData, meta interface{}) error { | ||
config := meta.(*transport_tpg.Config) | ||
|
||
id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/cloudVmClusters/{{cloud_vm_cluster_id}}") | ||
if err != nil { | ||
return fmt.Errorf("Error constructing id: %s", err) | ||
} | ||
err = resourceOracleDatabaseCloudVmClusterRead(d, meta) | ||
if err != nil { | ||
return err | ||
} | ||
d.SetId(id) | ||
|
||
return nil | ||
} |
46 changes: 46 additions & 0 deletions
46
google/services/oracledatabase/data_source_oracle_database_cloud_vm_cluster_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
package oracledatabase_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
) | ||
|
||
func TestAccOracleDatabaseCloudVmCluster_basic(t *testing.T) { | ||
t.Parallel() | ||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccOracleDatabaseCloudVmCluster_basic(), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "display_name"), | ||
resource.TestCheckResourceAttrSet("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "exadata_infrastructure"), | ||
resource.TestCheckResourceAttrSet("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "cidr"), | ||
resource.TestCheckResourceAttrSet("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "properties.#"), | ||
resource.TestCheckResourceAttrSet("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "properties.0.cpu_core_count"), | ||
resource.TestCheckResourceAttrSet("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "properties.0.cluster_name"), | ||
resource.TestCheckResourceAttr("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "gcp_oracle_zone", "us-east4-b-r1"), | ||
resource.TestCheckResourceAttr("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "properties.0.node_count", "2"), | ||
resource.TestCheckResourceAttr("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "properties.0.state", "AVAILABLE"), | ||
resource.TestCheckResourceAttr("data.google_oracle_database_cloud_vm_cluster.my-vmcluster", "properties.0.shape", "Exadata.X9M"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccOracleDatabaseCloudVmCluster_basic() string { | ||
return fmt.Sprintf(` | ||
data "google_oracle_database_cloud_vm_cluster" "my-vmcluster"{ | ||
cloud_vm_cluster_id = "ofake-do-not-delete-tf-vmcluster" | ||
project = "oci-terraform-testing" | ||
location = "us-east4" | ||
} | ||
`) | ||
} |
34 changes: 34 additions & 0 deletions
34
website/docs/d/oracle_database_cloud_vm_cluster.html.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
subcategory: "Oracle Database" | ||
description: |- | ||
Get information about a CloudVmCluster. | ||
--- | ||
|
||
# google_oracle_database_cloud_vm_cluster | ||
|
||
Get information about a CloudVmCluster. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
data "google_oracle_database_cloud_vm_cluster" "my-vmcluster"{ | ||
location = "us-east4" | ||
cloud_vm_cluster_id = "vmcluster-id" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `cloud_vm_cluster_id` - (Required) The ID of the VM Cluster. | ||
|
||
* `location` - (Required) The location of the resource. | ||
|
||
- - - | ||
* `project` - (Optional) The project in which the resource belongs. If it | ||
is not provided, the provider project is used. | ||
|
||
## Attributes Reference | ||
|
||
See [google_oracle_database_cloud_vm_cluster](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_oracle_database_cloud_vm_cluster#argument-reference) resource for details of the available attributes. |