Skip to content

Commit

Permalink
datasource & resource instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaut Di Prima committed Oct 9, 2024
1 parent 1af54b1 commit 340c8b7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions ovh/data_cloud_project_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func dataSourceCloudProjectInstanceRead(d *schema.ResourceData, meta interface{}
attachedVolume["id"] = res.AttachedVolumes[i].Id
attachedVolumes = append(attachedVolumes, attachedVolume)
}

d.Set("addresses", addresses)
d.Set("flavor_id", res.FlavorId)
d.Set("flavor_name", res.FlavorName)
Expand Down
4 changes: 4 additions & 0 deletions ovh/data_cloud_project_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ func TestAccDataSourceCloudProjecInstance_basic(t *testing.T) {
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_instance.test", "flavor_name"),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_instance.test", "flavor_id"),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_instance.test", "id"),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_instance.test", "image_id"),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_instance.test", "name"),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_instance.test", "ssh_key"),
resource.TestCheckResourceAttrSet("data.ovh_cloud_project_instance.test", "region"),
),
},
},
Expand Down
18 changes: 17 additions & 1 deletion ovh/data_cloud_project_instances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,23 @@ func TestAccDataSourceCloudProjecInstances_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(
"data.ovh_cloud_project_instances.instances",
"instances.#",
"instances.0.flavor_id",
),
resource.TestCheckResourceAttrSet(
"data.ovh_cloud_project_instances.instances",
"instances.0.flavor_name",
),
resource.TestCheckResourceAttrSet(
"data.ovh_cloud_project_instances.instances",
"instances.0.id",
),
resource.TestCheckResourceAttrSet(
"data.ovh_cloud_project_instances.instances",
"instances.0.image_id",
),
resource.TestCheckResourceAttrSet(
"data.ovh_cloud_project_instances.instances",
"instances.0.ssh_key",
),
),
},
Expand Down
1 change: 1 addition & 0 deletions ovh/resource_cloud_project_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func resourceCloudProjectInstance() *schema.Resource {
Type: schema.TypeSet,
Required: true,
Description: "Flavor information",
ForceNew: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"flavor_id": {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ variables must also be set:

* `OVH_CLOUD_PROJECT_INSTANCE_ID_TEST` - The ID of the instance to test

* `OVH_CLOUD_PROJECT_INSTANCE_NAME_TEST` - The ID of the instance to test
* `OVH_CLOUD_PROJECT_INSTANCE_NAME_TEST` - The Name of the instance to test

* `OVH_CLOUD_PROJECT_KUBE_REGION_TEST` - The region of your public cloud kubernetes project.

Expand Down

0 comments on commit 340c8b7

Please sign in to comment.