-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impl Dedicated Nasha #349
Impl Dedicated Nasha #349
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several suggestions about the name of the product :)
|
||
# ovh_dedicated_nasha (Data Source) | ||
|
||
Use this data source to retrieve information about a dedicated nasha. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this data source to retrieve information about a dedicated nasha. | |
Use this data source to retrieve information about a dedicated HA-NAS. |
page_title: "OVH: dedicated_nasha" | ||
sidebar_current: "docs-ovh-datasource-dedicated-nasha" | ||
description: |- | ||
Get information of a dedicated nasha. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get information of a dedicated nasha. | |
Get information of a dedicated HA-NAS. |
|
||
## Argument Reference | ||
|
||
* `service_name` - (Required) The service_name of your dedicated NASHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `service_name` - (Required) The service_name of your dedicated NASHA. | |
* `service_name` - (Required) The service_name of your dedicated HA-NAS. |
|
||
## Attributes Reference | ||
|
||
`id` is set with the service_name of the dedicated nasha. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`id` is set with the service_name of the dedicated nasha. | |
`id` is set with the service_name of the dedicated HA-NAS. |
In addition, the following attributes are exported: | ||
|
||
* `service_name` - The storage service name | ||
* `can_create_partition` - True, if partition creation is allowed on this nas HA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `can_create_partition` - True, if partition creation is allowed on this nas HA | |
* `can_create_partition` - True, if partition creation is allowed on this HA-NAS |
ovh/resource_dedicated_nasha_test.go
Outdated
return fmt.Errorf("calling GET %s :\n\t %s", endpoint, err.Error()) | ||
} | ||
|
||
fmt.Printf("NASHA partition snapshot : %+v\n", partitionSnapshotResponse) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("NASHA partition snapshot : %+v\n", partitionSnapshotResponse) | |
fmt.Printf("HA-NAS partition snapshot: %+v\n", partitionSnapshotResponse) |
ovh/resource_dedicated_nasha_test.go
Outdated
return fmt.Errorf("calling GET %s :\n\t %s", endpoint, err.Error()) | ||
} | ||
|
||
fmt.Printf("NASHA partition : %+v\n", partitionResponse) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("NASHA partition : %+v\n", partitionResponse) | |
fmt.Printf("HA-NAS partition: %+v\n", partitionResponse) |
ovh/resource_dedicated_nasha_test.go
Outdated
return fmt.Errorf("calling GET %s :\n\t %s", endpoint, err.Error()) | ||
} | ||
|
||
fmt.Printf("NASHA partition access : %+v\n", partitionAccessResponse) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("NASHA partition access : %+v\n", partitionAccessResponse) | |
fmt.Printf("HA-NAS partition access: %+v\n", partitionAccessResponse) |
ovh/resource_dedicated_nasha_test.go
Outdated
partitionSnapshotResponse := &DedicatedNASHAPartitionSnapshot{} | ||
err := config.OVHClient.Get(endpoint, partitionSnapshotResponse) | ||
if err != nil { | ||
return fmt.Errorf("calling GET %s :\n\t %s", endpoint, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("calling GET %s :\n\t %s", endpoint, err.Error()) | |
return fmt.Errorf("calling GET %s:\n\t %s", endpoint, err.Error()) |
ovh/resource_dedicated_nasha_test.go
Outdated
|
||
err := config.OVHClient.Get(endpoint, nil) | ||
if err == nil { | ||
return fmt.Errorf("NASHA Partition (%s) still exists", parititionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fmt.Errorf("NASHA Partition (%s) still exists", parititionName) | |
return fmt.Errorf("HA-NAS Partition (%s) still exists", partitionName) |
Thanks @scraly for review my PR. |
Yes the name of the resource and datasource are good, because it matches with the API endpoint but I think we need to be homogeneous with the product name: https://www.ovhcloud.com/en-gb/storage-solutions/nas-ha/ :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix parititionName
to partitionName
ovh/resource_dedicated_nasha_test.go
Outdated
} | ||
|
||
serviceName := nashaPartitionAccessResource.Primary.Attributes["service_name"] | ||
parititionName := nashaPartitionAccessResource.Primary.Attributes["name"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parititionName := nashaPartitionAccessResource.Primary.Attributes["name"] | |
partitionName := nashaPartitionAccessResource.Primary.Attributes["name"] |
ovh/resource_dedicated_nasha_test.go
Outdated
parititionName := nashaPartitionAccessResource.Primary.Attributes["name"] | ||
|
||
config := testAccProvider.Meta().(*Config) | ||
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, parititionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, parititionName) | |
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, partitionName) |
ovh/resource_dedicated_nasha_test.go
Outdated
parititionName := nashaPartitionAccessResource.Primary.Attributes["name"] | ||
|
||
config := testAccProvider.Meta().(*Config) | ||
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, parititionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, parititionName) | |
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, partitionName) |
ovh/resource_dedicated_nasha_test.go
Outdated
parititionName := nashaPartitionAccessResource.Primary.Attributes["name"] | ||
|
||
config := testAccProvider.Meta().(*Config) | ||
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, parititionName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, parititionName) | |
endpoint := fmt.Sprintf("/dedicated/nasha/%s/partition/%s", serviceName, partitionName) |
b92be39
to
5651f70
Compare
Fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some suggestions again :-)
Moreover, the creation of resources are working :
$ terraform apply
data.ovh_dedicated_nasha.foo: Reading...
ovh_dedicated_nasha_partition.my-partition: Refreshing state... [id=zpool-xxxxxx/my-partition]
data.ovh_dedicated_nasha.foo: Read complete after 1s [id=zpool-xxxxxx]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# ovh_dedicated_nasha_partition_access.my-partition will be created
+ resource "ovh_dedicated_nasha_partition_access" "my-partition" {
+ id = (known after apply)
+ ip = "123.123.123.123/32"
+ partition_name = "my-partition"
+ service_name = "zpool-xxxxxx"
+ type = "readwrite"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
ovh_dedicated_nasha_partition_access.my-partition: Creating...
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [10s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [20s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [30s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [40s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [50s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Creation complete after 51s [id=zpool-xxxxxx/my-partition/123.123.123.123/32]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
But I have an issue when I want to "read" the partition_access :
$ terraform apply
data.ovh_dedicated_nasha.foo: Reading...
ovh_dedicated_nasha_partition_access.my-partition: Refreshing state... [id=zpool-xxxx/my-partition/123.123.123.123/32]
ovh_dedicated_nasha_partition.my-partition: Refreshing state... [id=zpool-xxxx/my-partition]
data.ovh_dedicated_nasha.foo: Read complete after 1s [id=zpool-xxxx]
╷
│ Error: cant parse access partition id: zpool-xxxx/my-partition/123.123.123.123/32
│
│ with ovh_dedicated_nasha_partition_access.my-partition,
│ on pr349.tf line 12, in resource "ovh_dedicated_nasha_partition_access" "my-partition":
│ 12: resource "ovh_dedicated_nasha_partition_access" "my-partition" {
│
* `ip` - Access IP of HA-NAS | ||
* `monitored` - Send an email to customer if any issue is detected | ||
* `zpool_capacity` - percentage of HA-NAS space used in % | ||
* `zpool_size` - the size of the HA-NAS in Go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The size is in ... bytes, in GB? :-)
``` | ||
resource "ovh_dedicated_nasha_partition" "foo" { | ||
service_name = "zpool-12345" | ||
name = "foo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name = "foo" | |
name = "my-partition" |
## Import | ||
|
||
HA-NAS partition access can be imported using the `{service_name}/{partition_name}/{ip}`, e.g. | ||
`$ terraform import ovh_dedicated_nasha_partition_access.foo zpool-12345/foo/123.123.123.123%2F32` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$ terraform import ovh_dedicated_nasha_partition_access.foo zpool-12345/foo/123.123.123.123%2F32` | |
`$ terraform import ovh_dedicated_nasha_partition_access.foo zpool-12345/my-partition/123.123.123.123%2F32` |
## Import | ||
|
||
HA-NAS can be imported using the `{service_name}/{name}`, e.g. | ||
`$ terraform import ovh_dedicated_nasha_partition.foo zpool-12345/foo` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$ terraform import ovh_dedicated_nasha_partition.foo zpool-12345/foo` | |
`$ terraform import ovh_dedicated_nasha_partition.foo zpool-12345/my-partition` |
service_name = "zpool-12345" | ||
partition_name = "foo" | ||
ip = "123.123.123.123/32" | ||
protocol = "NFS" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protocol = "NFS" | |
type = "readwrite" |
``` | ||
resource "ovh_dedicated_nasha_partition_snapshot" "foo" { | ||
service_name = "zpool-12345" | ||
partition_name = "foo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partition_name = "foo" | |
partition_name = "my-partition" |
## Example Usage | ||
|
||
``` | ||
resource "ovh_dedicated_nasha_partition_snapshot" "foo" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resource "ovh_dedicated_nasha_partition_snapshot" "foo" { | |
resource "ovh_dedicated_nasha_partition_snapshot" "my-partition" { |
|
||
The following arguments are supported: | ||
|
||
* `service_name` - (Required) The internal name of your HA-NAS (it has to be ordered via OVH interface) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `service_name` - (Required) The internal name of your HA-NAS (it has to be ordered via OVH interface) | |
* `service_name` - (Required) The internal name of your HA-NAS (it has to be ordered via OVHcloud interface) |
|
||
The following arguments are supported: | ||
|
||
* `service_name` - (Required) The internal name of your HA-NAS (it has to be ordered via OVH interface) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `service_name` - (Required) The internal name of your HA-NAS (it has to be ordered via OVH interface) | |
* `service_name` - (Required) The internal name of your HA-NAS (it has to be ordered via OVHcloud interface) |
## Import | ||
|
||
HA-NAS partition snapshot can be imported using the `{service_name}/{partition_name}/{type}`, e.g. | ||
`$ terraform import ovh_dedicated_nasha_partition_snapshot.foo zpool-12345/foo/day-3` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$ terraform import ovh_dedicated_nasha_partition_snapshot.foo zpool-12345/foo/day-3` | |
`$ terraform import ovh_dedicated_nasha_partition_snapshot.foo zpool-12345/my-partition/day-3` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some suggestions again :-)
Moreover, the creation of resources are working :
$ terraform apply
data.ovh_dedicated_nasha.foo: Reading...
ovh_dedicated_nasha_partition.my-partition: Refreshing state... [id=zpool-xxxxxx/my-partition]
data.ovh_dedicated_nasha.foo: Read complete after 1s [id=zpool-xxxxxx]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# ovh_dedicated_nasha_partition_access.my-partition will be created
+ resource "ovh_dedicated_nasha_partition_access" "my-partition" {
+ id = (known after apply)
+ ip = "123.123.123.123/32"
+ partition_name = "my-partition"
+ service_name = "zpool-xxxxxx"
+ type = "readwrite"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
ovh_dedicated_nasha_partition_access.my-partition: Creating...
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [10s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [20s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [30s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [40s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Still creating... [50s elapsed]
ovh_dedicated_nasha_partition_access.my-partition: Creation complete after 51s [id=zpool-xxxxxx/my-partition/123.123.123.123/32]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
But I have an issue when I want to "read" the partition_access :
$ terraform apply
data.ovh_dedicated_nasha.foo: Reading...
ovh_dedicated_nasha_partition_access.my-partition: Refreshing state... [id=zpool-xxxx/my-partition/123.123.123.123/32]
ovh_dedicated_nasha_partition.my-partition: Refreshing state... [id=zpool-xxxx/my-partition]
data.ovh_dedicated_nasha.foo: Read complete after 1s [id=zpool-xxxx]
╷
│ Error: cant parse access partition id: zpool-xxxx/my-partition/123.123.123.123/32
│
│ with ovh_dedicated_nasha_partition_access.my-partition,
│ on pr349.tf line 12, in resource "ovh_dedicated_nasha_partition_access" "my-partition":
│ 12: resource "ovh_dedicated_nasha_partition_access" "my-partition" {
│
I fixed this issue yesterday. here: 9940526 Acceptance test case works for me. If I'm not mistaken, he should also work for your test. |
After your fix, I have still this issue in the read access:
|
You should retry without context. In your case the access resource have a bad ID, generated before my fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are now Ok for me :-)
So please look at every suggestions have done and commit them.
Thank you
## Example Usage | ||
|
||
```hcl | ||
data "ovh_dedicated_nasha" "foo" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data "ovh_dedicated_nasha" "foo" { | |
data "ovh_dedicated_nasha" "my-nas-ha" { |
## Import | ||
|
||
HA-NAS can be imported using the `{service_name}/{name}`, e.g. | ||
`$ terraform import ovh_dedicated_nasha_partition.foo zpool-12345/my-partition` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$ terraform import ovh_dedicated_nasha_partition.foo zpool-12345/my-partition` | |
`$ terraform import ovh_dedicated_nasha_partition.my-partition zpool-12345/my-partition` |
## Import | ||
|
||
HA-NAS can be imported using the `{service_name}/{name}`, e.g. | ||
`$ terraform import ovh_dedicated_nasha_partition.foo zpool-12345/my-partition` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$ terraform import ovh_dedicated_nasha_partition.foo zpool-12345/my-partition` | |
`$ terraform import ovh_dedicated_nasha_partition.my-partition zpool-12345/my-partition` |
## Import | ||
|
||
HA-NAS partition access can be imported using the `{service_name}/{partition_name}/{ip}`, e.g. | ||
`$ terraform import ovh_dedicated_nasha_partition_access.foo zpool-12345/my-partition/123.123.123.123%2F32` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$ terraform import ovh_dedicated_nasha_partition_access.foo zpool-12345/my-partition/123.123.123.123%2F32` | |
`$ terraform import ovh_dedicated_nasha_partition_access.my-partition zpool-12345/my-partition/123.123.123.123%2F32` |
## Import | ||
|
||
HA-NAS partition snapshot can be imported using the `{service_name}/{partition_name}/{type}`, e.g. | ||
`$ terraform import ovh_dedicated_nasha_partition_snapshot.foo zpool-12345/my-partition/day-3` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`$ terraform import ovh_dedicated_nasha_partition_snapshot.foo zpool-12345/my-partition/day-3` | |
`$ terraform import ovh_dedicated_nasha_partition_snapshot.my-partition zpool-12345/my-partition/day-3` |
Good new feature, it's OK for me :) |
Description
Partial implementation NASHA resources / data with test and docs.
Thanks @goblain. Author of first implementation. see : #44
Type of change
Add Resources :
Add Data: