-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added volume module for Google Cloud NetApp Volume #9513
Conversation
Hello! I am a robot. It looks like you are a: Community Contributor @rileykarson, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
mmv1/products/netapp/volume.yaml
Outdated
# limitations under the License. | ||
|
||
--- !ruby/object:Api::Resource | ||
name: 'volume' |
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: 'volume' | |
name: 'Volume' |
mmv1/products/netapp/volume.yaml
Outdated
- !ruby/object:Api::Type::String | ||
name: 'name' | ||
description: | ||
The name of the volume. Needs to be unique per location. |
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 name of the volume. Needs to be unique per location. | |
The name of the volume. Needs to be unique per location. |
mmv1/products/netapp/volume.yaml
Outdated
url_param_only: true | ||
examples: | ||
- !ruby/object:Provider::Terraform::Examples | ||
name: 'Volume_create' |
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: 'Volume_create' | |
name: 'volume_basic' |
- change the filename, we use _basic for the simple examples by convention!
base_url: projects/{{project}}/locations/{{location}}/volumes | ||
self_link: projects/{{project}}/locations/{{location}}/volumes/{{name}} | ||
create_url: projects/{{project}}/locations/{{location}}/volumes?volumeId={{name}} | ||
update_url: projects/{{project}}/locations/{{location}}/volumes/{{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.
We'll need to add an update test! https://googlecloudplatform.github.io/magic-modules/develop/test/#add-an-update-test
Each updatable field should have its value changed in at least one test!
mmv1/products/netapp/volume.yaml
Outdated
network_name: 'test-network' | ||
global_name: 'test-address' | ||
properties: | ||
# Fields go here |
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.
# Fields go here |
mmv1/products/netapp/volume.yaml
Outdated
- !ruby/object:Api::Type::String | ||
name: 'exportFull' | ||
description: | | ||
Full export ptah of the volume. |
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.
Full export ptah of the volume. | |
Full export path of the volume. |
mmv1/products/netapp/volume.yaml
Outdated
immutable: true | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'sourceSnapshot' |
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.
required: true
? We can remove it if we add sourceBackup
in the future.
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 5 files changed, 2724 insertions(+), 2 deletions(-)) Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_netapp_volume" "primary" {
export_policy {
rules {
access_type = # value needed
allowed_clients = # value needed
has_root_access = # value needed
kerberos5_read_only = # value needed
kerberos5_read_write = # value needed
kerberos5i_read_only = # value needed
kerberos5i_read_write = # value needed
kerberos5p_read_only = # value needed
kerberos5p_read_write = # value needed
nfsv3 = # value needed
nfsv4 = # value needed
}
}
restore_parameters {
source_snapshot = # value needed
}
restricted_actions = # value needed
snapshot_policy {
daily_schedule {
hour = # value needed
minute = # value needed
snapshots_to_keep = # value needed
}
enabled = # value needed
hourly_schedule {
minute = # value needed
snapshots_to_keep = # value needed
}
monthly_schedule {
days_of_month = # value needed
hour = # value needed
minute = # value needed
snapshots_to_keep = # value needed
}
weekly_schedule {
day = # value needed
hour = # value needed
minute = # value needed
snapshots_to_keep = # value needed
}
}
}
|
Tests analyticsTotal tests: Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccDataprocClusterIamPolicy|TestAccNetappvolume_volumeCreateExample |
Rerun these tests in REPLAYING mode to catch issues
|
Hi @rileykarson, Thanks for all the suggestions. I'll update the code and will push it in some time. |
Are we blocked by that? Can we use the workaround which was meanwhile mentioned in hashicorp/terraform-provider-google#16275? We need to move on! |
@G-NamanGupta any update on this? |
@imrannayer , we are working with google dev team to reach to a viable solution for the issue we are facing with VPC network. |
network = google_compute_network.peering_network.id | ||
} | ||
|
||
# Create a private connection |
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.
We're gonna want to use a bootstrapping function here- @shuyama1 was looking into some pre-work required to use one for this case. Leaving this open until that's resolved.
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.
#9598 is merged, which refactored the bootstrapping function BootstrapSharedServiceNetworkingConnection
to allow using different services. Hopefully it unblocks the test here.
BootstrapSharedServiceNetworkingConnection(t, "YOUR_NETWORK_NAME", acctest.ServiceNetworkWithParentService("netapp.servicenetworking.goog"))
is likely what you'll need in this case.
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.
Added the changes related to network, added update test and also did cosmetic changes asked by Riley.
Name of the Private Service Access allocated range. Inherited from storage pool. | ||
output: true | ||
- !ruby/object:Api::Type::String | ||
name: 'storagePool' |
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.
this seems like it would be immutable? Can we test changing it if not?
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.
Volumes can be assigned to a different storagePool in certain situations.
The condition set is complex and cannot be handled by the provider. Let the API return good or bad.
https://cloud.google.com/netapp/volumes/docs/configure-and-use/volumes/edit-volume
Summary: storagePool should be mutable. Test case: create two pools in same region with same parameters (VPC, AD, CMEK, LDAP), but differing service levels (premium and extreme). Reassign a volume from one to the other.
security_style = "UNIX" | ||
kerberos_enabled = false | ||
export_policy { | ||
rules { |
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 we add a second rule here?
access_type = "READ_ONLY" | ||
allowed_clients = "0.0.0.0/0" | ||
has_root_access = "true" | ||
kerberos5_read_only = false |
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 we change the value of these booleans between the update steps?
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.
has_root_access can be changed easily. All the kerberos parameters can only be changed it the volumes would be exported with Kerberos and that requires complex infrastructure to be in place in the test environment. Not realistic.
capacity_gib = "200" | ||
share_name = "testshare" | ||
storage_pool = google_netapp_storage_pool.default.name | ||
protocols = ["NFSV3"] |
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 we add a protocol in this update?
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.
Protocols setting is immutable. We should mark it immutable.
share_name = "testshare" | ||
storage_pool = google_netapp_storage_pool.default.name | ||
protocols = ["NFSV3"] | ||
smb_settings = [] |
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 we set some SMB settings in the initial step?
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 recommend:
SHOW_SNAPSHOT, SHOW_PREVIOUS_VERSIONS
I intentionally left away a few settings which I expect the API to set automatically during volume creation, like BROWSABLE, CHANGE_NOTIFY, OPLOCKS (and maybe more or less).
TF should expect that create returns some settings which the user didn't put in.
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 thought about it again: smb_settings only apply to SMB volumes and SMb volumes cannot be created without an AD server in the test environment and setting up an AD server is pretty heavy weight and out of scope for the tests.
But please make sure a TF is prepared to receive back some default values from the create operation.
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 tested it. If smb_settings isn't specified at create, API doesn't return smb_settings on subsequent reads. That means it doesn't return any unexpected default values.
storage_pool = google_netapp_storage_pool.default.name | ||
protocols = ["NFSV3"] | ||
smb_settings = [] | ||
unix_permissions = "0770" |
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.
unix_permissions = "0770" | |
unix_permissions = "0740" |
value= "pool" | ||
} | ||
description = "This is a test description" | ||
snapshot_directory = false |
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 we change this value during the update?
minute = 1 | ||
snapshots_to_keep = 1 | ||
} | ||
enabled = true |
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.
Could we add a third update step where we disable the schedule?
mmv1/products/netapp/volume.yaml
Outdated
description: |- | ||
Set the day or days of the month to make a snapshot (1-31). Accepts a comma separated number of days. Defaults to '1'. | ||
- !ruby/object:Api::Type::NestedObject | ||
name: restoreParameters |
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 this appear in a test?
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.
No. This is a parameter for Volume Backup. The resources for backup (backupPolicies, backupVaults and backupVaults.backups) are new their creation is not scheduled yet.
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.
Should we consider excluding this from implementation for now? We can implement it after the resources for backup are added to the provider since we can't test the creation of volume from backup and can not test if the feature is working or not for now.
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 6 files changed, 3028 insertions(+), 2 deletions(-)) Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_netapp_volume" "primary" {
restore_parameters {
source_snapshot = # value needed
}
}
|
Tests analyticsTotal tests: Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccNetappvolume_volumeCreateExample_update|TestAccNetappVolume_volumeBasicExample |
Tests analyticsTotal tests: Click here to see the affected service packages
Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccNetappVolume_volumeBasicExample|TestAccNetappVolume_volumeBasicExample_update |
|
@G-NamanGupta Tests failed with error |
/gcbrun |
Okay, I didn't expect my /gcbrun to work, but I had to test it anyway :D |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 6 files changed, 2943 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Click here to see the affected service packages
Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccNetappVolume_volumeBasicExample|TestAccNetappVolume_volumeBasicExample_update |
Rerun these tests in REPLAYING mode to catch issues
|
@shuyama1 Can you please have a look if the resource is fine now? Sorry for being pushy. |
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.
Thank you!
@rileykarson @shuyama1 Many, many thanks for your help on getting this reviewed and merged. Very appreciated! |
@okrause is there any plan to add |
…rm#9513) * added volume module * Added updated function and network fix * updated update test fields. * updated unixPermissions field. * updated test file for snapshot_policy * updated description. updated test file with basic example and function name. * removed the *_UNSPECIFIED values for inputs Default values for minutes, hours, days and day_of_week in snapshot block Updated tests to incorporate suggestions by shuya Fixes some indentation in tests Updates some test to get better test coverage commented restoreParamters as suggested by Shuya. * updated tests to use us-west1 region * updated region to us-west2
We plan to add more features over time. backupConfig was blocked so far, since we didn't had resources for Backup Vault and Backup Policy. They are now merged. Adding backupConfig should be easy to do, but we may experience some problems to solve in the required test code due to associating/disassociating a volume from a vault. Need to take a closer look. |
…rm#9513) * added volume module * Added updated function and network fix * updated update test fields. * updated unixPermissions field. * updated test file for snapshot_policy * updated description. updated test file with basic example and function name. * removed the *_UNSPECIFIED values for inputs Default values for minutes, hours, days and day_of_week in snapshot block Updated tests to incorporate suggestions by shuya Fixes some indentation in tests Updates some test to get better test coverage commented restoreParamters as suggested by Shuya. * updated tests to use us-west1 region * updated region to us-west2
…rm#9513) * added volume module * Added updated function and network fix * updated update test fields. * updated unixPermissions field. * updated test file for snapshot_policy * updated description. updated test file with basic example and function name. * removed the *_UNSPECIFIED values for inputs Default values for minutes, hours, days and day_of_week in snapshot block Updated tests to incorporate suggestions by shuya Fixes some indentation in tests Updates some test to get better test coverage commented restoreParamters as suggested by Shuya. * updated tests to use us-west1 region * updated region to us-west2
…rm#9513) * added volume module * Added updated function and network fix * updated update test fields. * updated unixPermissions field. * updated test file for snapshot_policy * updated description. updated test file with basic example and function name. * removed the *_UNSPECIFIED values for inputs Default values for minutes, hours, days and day_of_week in snapshot block Updated tests to incorporate suggestions by shuya Fixes some indentation in tests Updates some test to get better test coverage commented restoreParamters as suggested by Shuya. * updated tests to use us-west1 region * updated region to us-west2
Fixes hashicorp/terraform-provider-google#16019
This PR is to support provisioning volume for Google Cloud NetApp Volumes through GCP terraform provider.
This is extension to #9229