-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
I'm attempting to script the creation of new PostgreSQL systems but running into issues. The request seems to be accepted by the API and a work request is created but they end up failing to create. Creating Postgres via the OCI console with the same settings works correctly so I believe I am passing something in the request that is causing the behavior. I opened an OCI SR to look at the creation error but was hoping to have you validate that I am using this module correctly.
Below is a slimmed down version of the code being used with comments showing what is present in each object.
$PGCreateDbObj = New-Object -TypeName Oci.PsqlService.Models.CreateDbSystemDetails
$PGCreateDbObj.DisplayName = 'TestPostgres'
$PGCreateDbObj.Description = 'TestPostgres Description'
$PGCreateDbObj.CompartmentId = 'ocid1.compartment.oc1..aaaREDACTED'
$PGCreateDbObj.SystemType = 'OCIOPTIMIZEDSTORAGE'
$PGCreateDbObj.DbVersion = '14'
$PGCreateDbObj.Shape = 'PostgreSQL.VM.Standard.E4.Flex.2.32GB'
$PGCreateDbObj.InstanceCount = '2'
$PGStorageDetailsObj = New-Object -TypeName Oci.PsqlService.Models.OciOptimizedStorageDetails
$PgStorageDetailsObj.IsRegionallyDurable = 'true'
$PGStorageDetailsObj.Iops = '300000'
$PGCreateDbObj.StorageDetails = $PGStorageDetailsObj
$PGCredentialsObj = New-Object -TypeName Oci.PsqlService.Models.Credentials
$PGCredentialsObj.Username = 'PostgresAdmin'
$PGVaultSecretObj = New-Object -TypeName Oci.PsqlService.Models.VaultSecretPasswordDetails
$PGVaultSecretObj.SecretId = 'ocid1.vaultsecret.oc1.iad.amaaaREDACTED'
$PGVaultSecretObj.SecretVersion = '1'
$PGCredentialsObj.PasswordDetails = $PGVaultSecretObj
$PGCreateDbObj.Credentials = $PGCredentialsObj
$PGNetworkDetailsObj = New-Object -TypeName Oci.PsqlService.Models.NetworkDetails
$PGNetworkDetailsObj.SubnetID = 'ocid1.subnet.oc1.iad.aaaREDACTED'
$PGCreateDbObj.NetworkDetails = $PGNetworkDetailsObj
$PGMgmtPolicyDetObj = New-Object -TypeName Oci.PsqlService.Models.ManagementPolicyDetails
$PGMgmtPolicyDetObj.MaintenanceWindowStart ='SUN 01:00'
$PGBackupDailyPolicyObj = New-Object -TypeName Oci.PsqlService.Models.DailyBackupPolicy
$PGBackupDailyPolicyObj.BackupStart = '00:00'
$PGBackupDailyPolicyObj.RetentionDays = '14'
$PGMgmtPolicyDetObj.BackupPolicy = $PGBackupDailyPolicyObj
$PGCreateDbObj.ManagementPolicy = $PGMgmtPolicyDetObj
<#
Example of output of what PGCreateDBObj looks like before making the call
DisplayName : TestPostgres
Description : TestPostgres Description
CompartmentId : ocid1.compartment.oc1..aaaREDACTEDOCID
SystemType : OciOptimizedStorage
DbVersion : 14
ConfigId :
StorageDetails : Oci.PsqlService.Models.OciOptimizedStorageDetails
Shape : PostgreSQL.VM.Standard.E4.Flex.2.32GB
InstanceOcpuCount :
InstanceMemorySizeInGBs :
InstanceCount : 2
InstancesDetails :
Credentials : Oci.PsqlService.Models.Credentials
NetworkDetails : Oci.PsqlService.Models.NetworkDetails
ManagementPolicy : Oci.PsqlService.Models.ManagementPolicyDetails
Source :
FreeformTags :
DefinedTags :
#>
$PGCreateOutput = New-OCIPsqlDbSystem -CreateDbSystemDetails $PGCreateDbObj -Auth InstancePrincipal
<#
Example output after call showing its in CREATING state.
Id : ocid1.postgresqldbsystem.oc1.iad.amaaREDACTEDOCID
DisplayName : TestPostgres
Description : TestPostgres Description
CompartmentId : ocid1.compartment.oc1..aaaaaaREDACTEDOCID
TimeCreated : 2/21/2024 3:28:38 PM
TimeUpdated : 2/21/2024 3:28:38 PM
LifecycleState : Creating
LifecycleDetails : CREATING
AdminUsername : PostgresAdmin
FreeformTags : {}
DefinedTags : {[Oracle-Tags, System.Collections.Generic.Dictionary`2[System.String,System.Object]]}
SystemTags : {}
SystemType : OciOptimizedStorage
DbVersion : 14
ConfigId : ocid1.postgresqldefaultconfiguration.oc1.iad.amaaaaREDACTEDOCID
Shape : VM.Standard.E4.Flex
InstanceOcpuCount : 2
InstanceMemorySizeInGBs : 32
InstanceCount : 2
Instances : {bd3c594b-2f60-4fc9-bee0-878fa639afc2, 3dba5d0c-1028-4b4b-a289-d38e27cfb425}
StorageDetails : Oci.PsqlService.Models.OciOptimizedStorageDetails
NetworkDetails : Oci.PsqlService.Models.NetworkDetails
ManagementPolicy : Oci.PsqlService.Models.ManagementPolicy
Source :
#>
<#
After around 5 minutes the workrequest fails and this error is in the Console on the workrequest:
Error occurred when executing CREATE_DBSYSTEM workflow: Error returned by CreatePrivateEndpoint operation in VirtualNetwork service.(400, InvalidParameter, false)
invalid Network Resource Group OCID: OCID doesn't match expected pattern or contains invalid characters.
(opc-request-id: /REDACTED) Timestamp: 2024-02-21T15:33:45.446Z Client version:
Oracle-JavaSDK/2.66.1 Request Endpoint: https://iaas.us-ashburn-1.oraclecloud.com/20160918/privateEndpoints Troubleshooting Tips:
See https://docs.oracle.com/en-us/iaas/Content/API/References/apierrors.htm#apierrors_400__400_invalidparameter for more information about resolving this error
Also see https://docs.oracle.com/iaas/api/#/en/iaas/20160918/PrivateEndpoint/CreatePrivateEndpoint for details on this operation's requirements.
To get more info on the failing request, you can enable debug level logs as mentioned in `Using SLF4J for Logging section` in
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/javasdkconfig.htm. If you are unable to resolve this VirtualNetwork issue,
please contact Oracle support and provide them this full error message.
#>
Metadata
Metadata
Assignees
Labels
No labels