Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,29 @@ func CertificatesManagementCertificateResource() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{
"ISSUED_BY_INTERNAL_CA",
"MANAGED_EXTERNALLY_ISSUED_BY_INTERNAL_CA",
"IMPORTED",
}, true),
},
"cert_chain_pem": {
Type: schema.TypeString,
Optional: true,
Computed: false,
},
"certificate_pem": {
Type: schema.TypeString,
Optional: true,
Computed: false,
},
"private_key_pem": {
Type: schema.TypeString,
Optional: true,
Computed: false,
},
"private_key_pem_passphrase": {
Type: schema.TypeString,
Optional: true,
Computed: false,
},
"certificate_profile_type": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1135,6 +1156,30 @@ func (s *CertificatesManagementCertificateResourceCrud) mapToCreateCertificateCo
configType = "" // default value
}
switch strings.ToLower(configType) {
case strings.ToLower("IMPORTED"):
details := oci_certificates_management.CreateCertificateByImportingConfigDetails{}
if certChainPem, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "cert_chain_pem")); ok {
tmp := certChainPem.(string)
details.CertChainPem = &tmp
}
if certificatePem, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "certificate_pem")); ok {
tmp := certificatePem.(string)
details.CertificatePem = &tmp
}
if privateKeyPem, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "private_key_pem")); ok {
tmp := privateKeyPem.(string)
details.PrivateKeyPem = &tmp
}
if privateKeyPemPassphrase, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "private_key_pem_passphrase")); ok {
tmp := privateKeyPemPassphrase.(string)
details.PrivateKeyPemPassphrase = &tmp
}
if versionName, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "version_name")); ok {
tmp := versionName.(string)
details.VersionName = &tmp
}

baseObject = details
case strings.ToLower("ISSUED_BY_INTERNAL_CA"):
details := oci_certificates_management.CreateCertificateIssuedByInternalCaConfigDetails{}
if validity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "validity")); ok {
Expand Down Expand Up @@ -1440,6 +1485,26 @@ func (s *CertificatesManagementCertificateResourceCrud) mapToUpdateCertificateCo
configType = "" // default value
}
switch strings.ToLower(configType) {
case strings.ToLower("IMPORTED"):
details := oci_certificates_management.UpdateCertificateByImportingConfigDetails{}
if certChainPem, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "cert_chain_pem")); ok {
tmp := certChainPem.(string)
details.CertChainPem = &tmp
}
if certificatePem, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "certificate_pem")); ok {
tmp := certificatePem.(string)
details.CertificatePem = &tmp
}
if privateKeyPem, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "private_key_pem")); ok {
tmp := privateKeyPem.(string)
details.PrivateKeyPem = &tmp
}
if privateKeyPemPassphrase, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "private_key_pem_passphrase")); ok {
tmp := privateKeyPemPassphrase.(string)
details.PrivateKeyPemPassphrase = &tmp
}

baseObject = details
case strings.ToLower("ISSUED_BY_INTERNAL_CA"):
details := oci_certificates_management.UpdateCertificateIssuedByInternalCaConfigDetails{}
if validity, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "validity")); ok {
Expand Down