-
Notifications
You must be signed in to change notification settings - Fork 4.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
new resource and data source : azurerm_oracle_cloud_vm_cluster #27176
new resource and data source : azurerm_oracle_cloud_vm_cluster #27176
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.
Thanks @eelhomsi - i've left some comments inline as well as triggered CI for thisPR
} | ||
|
||
func NewClient(o *common.ClientOptions) (*Client, error) { | ||
o.DisableCorrelationRequestID = 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.
how come we are disabling this? please add a comment detailing why
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.
Good point - I've added a comment explaining why we disabled this.
}, | ||
"cloud_exadata_infrastructure_id": { |
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.
there should be a new line here
}, | |
"cloud_exadata_infrastructure_id": { | |
}, | |
"cloud_exadata_infrastructure_id": { |
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.
Done, thanks!
"location": commonschema.Location(), | ||
"name": { | ||
Type: pluginsdk.TypeString, | ||
Required: true, | ||
}, | ||
"resource_group_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.
"location": commonschema.Location(), | |
"name": { | |
Type: pluginsdk.TypeString, | |
Required: true, | |
}, | |
"resource_group_name": { | |
"location": commonschema.Location(), | |
"name": { | |
Type: pluginsdk.TypeString, | |
Required: true, | |
}, | |
"resource_group_name": { |
should be new lines here. apply to all other schema properties
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've added new lines for all the schema properties.
Type: pluginsdk.TypeString, | ||
Required: true, | ||
}, | ||
"tags": commonschema.Tags(), |
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 should be at the bottom
%s | ||
resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { | ||
location = "%[3]s" | ||
name = "OFakeVmacctest%[2]d" | ||
resource_group_name = azurerm_resource_group.test.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.
this will need to be formatted with terrafmt
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.
Done thanks!
internal/services/oracledatabase/cloud_vm_cluster_resource_test.go
Outdated
Show resolved
Hide resolved
|
||
* `cpu_core_count` - (Required) The number of CPU cores enabled on the cloud VM cluster. | ||
|
||
* `db_servers` - (Required) The list of DB servers. |
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.
list of? hostnames/ ids? if host names
* `db_servers` - (Required) The list of DB servers. | |
* `db_server_host_namess` - (Required) The list of DB server hostnames to use. |
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.
@katbyte I agree with your comments on the naming of these arguments, however I have been asked to match the official OCI Terraform provider here (concerns about consistent customer experience), so I don't have a lot of freedom in changing them myself:
https://registry.terraform.io/providers/oracle/oci/latest/docs/data-sources/database_cloud_vm_cluster#db_servers
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.
Typo db_server_host_namess
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.
These changes were not used, so the typo was not committed.
|
||
* `display_name` - (Required) The user-friendly name for the cloud VM cluster. The name does not need to be unique.. | ||
|
||
* `gi_version` - (Required) A valid Oracle Grid Infrastructure (GI) software version. |
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 should avoid ambiguous acronyms
* `gi_version` - (Required) A valid Oracle Grid Infrastructure (GI) software version. | |
* `oracle_grid_nfrastructure_version` - (Required) A valid Oracle Grid Infrastructure (GI) software version. |
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.
Typo oracle_grid_nfrastructure_version
.
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.
These changes were not used, so the typo was not committed.
|
||
* `cluster_name` - (Optional) The cluster name for cloud VM cluster. | ||
|
||
* `data_collection_options` - (Optional) A `data_collection_options` block as defined below. |
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_collection_options` - (Optional) A `data_collection_options` block as defined below. | |
* `data_collection` - (Optional) A `data_collection_options` block as defined below. |
…t.go Co-authored-by: kt <[email protected]>
…d-data-source' into introduce-vm-cluster-resource-and-data-source
Type: pluginsdk.TypeString, | ||
Required: true, | ||
}, | ||
"resource_group_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.
this still needs to be updated to use common schema
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ForceNew: 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.
can we validate this is a proper id?
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.
Done, I'm now calling the SDK provided validator.
"cpu_core_count": { | ||
Type: pluginsdk.TypeInt, | ||
Required: 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.
can we validate tyhis? i presume it cannot be -1 or 0?
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.
Done!
Optional: true, | ||
Computed: true, | ||
ForceNew: 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.
and here. please add reasonable validation to all properties where possible.
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.
Done.
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
DiffSuppressFunc: GiVersionDiffSuppress, |
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.
why are we diff supressing here? please add a comment explaining
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 don't think this is needed anymore, so I have removed it.
output.Hostname = result.Model.Properties.Hostname | ||
output.LicenseModel = string(pointer.From(result.Model.Properties.LicenseModel)) | ||
output.MemorySizeInGbs = pointer.From(result.Model.Properties.MemorySizeInGbs) | ||
//output.SshPublicKeys = result.Model.Properties.SshPublicKeys |
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.
why is this commented out?
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.
Uncommented now!
output.VnetId = result.Model.Properties.VnetId | ||
// Optional |
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.
output.VnetId = result.Model.Properties.VnetId | |
// Optional | |
output.VnetId = result.Model.Properties.VnetId | |
// Optional |
output.VnetId = result.Model.Properties.VnetId | |
// Optional | |
output.VnetId = result.Model.Properties.VnetId | |
// Optional |
%s | ||
resource "azurerm_oracledatabase_cloud_vm_cluster" "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.
%s | |
resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { | |
%s | |
resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { |
%s | |
resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { | |
%s | |
resource "azurerm_oracledatabase_cloud_vm_cluster" "test" { |
"resource_group_name": { | ||
Type: pluginsdk.TypeString, | ||
Required: 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.
please use common schema here
"name": { | ||
Type: pluginsdk.TypeString, | ||
Required: true, | ||
ValidateFunc: validate.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.
this is used for multiple different nameS? are they actually all constrained in the same way?
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.
Yes both name and display_name will have the same constraints applied to them.
"strings" | ||
) | ||
|
||
func ConvertDataCollectionOptionsToInternal(dataCollectionOptions *cloudvmclusters.DataCollectionOptions) []DataCollectionOptionsModel { |
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.
These seem to be the expand/flatten functions? these should be in the same file they are used in & use the terminology the rest of the provider does
flatten functions take api response/data -> terraform/internal
expand functions take internal/tf -> api request
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.
Thanks, done.
…e-vm-cluster-resource-and-data-source
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.
Just a comment comments left ineline
// Example: Initial plan -> testHostname, final result after DBaaS -> testHostname-abc. | ||
// Since testHostname is a prefix of testHostname-abc, then computed diff is zero. | ||
func DbSystemHostnameDiffSuppress(_ string, old string, new string, _ *schema.ResourceData) bool { | ||
return EqualIgnoreCaseSuppressDiff(old, new) || NewIsPrefixOfOldDiffSuppress(old, new) |
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 shouldn't be ignoring case, terraform is case sensitive
- instead of suppressing the diff we should/could strip the suffix on read
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've removed the ignoring case part. Can you clarify the second point?
Co-authored-by: kt <[email protected]>
Co-authored-by: kt <[email protected]>
…e-vm-cluster-resource-and-data-source
…e-vm-cluster-resource-and-data-source
…e-vm-cluster-resource-and-data-source
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.
LGTM 🏖️
Hi @eelhomsi - Apologies, but we've had to revert this PR. Since it's previously been merged, we cannot re-open from here. Can you please submit a new PR from the Branch and we'll work with you to get it merged? Thanks! |
No problem @jackofallops PR recreated here: |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Community Note
Description
Introduce OracleDatabase VMCluster Resource & Data and DBServer Data
Most relevant changes in:
internal/services/oracledatabase/
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Testing
VMCluster Resource tests (ran one by one due to tenancy resourcing constraints):
VM Cluster Data source:
DB Server Data source:
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
CloudVmClusterResource,
CloudVmClusterDataSource, and
DBServersDataSource`.This is a (please select all that apply):
Note
If this PR changes meaningfully during the course of review please update the title and description as required.