-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b33d1a4
commit 814fdbc
Showing
115 changed files
with
665 additions
and
606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package configs | ||
|
||
const ( | ||
ApiHostSchemaEnvVar = "OKTAPAM_API_HOST" | ||
ApiKeySchemaEnvVar = "OKTAPAM_KEY" | ||
ApiKeySecretSchemaEnvVar = "OKTAPAM_SECRET" | ||
TeamSchemaEnvVar = "OKTAPAM_TEAM" | ||
|
||
ApiHostKey = "oktapam_api_host" | ||
ApiKeyKey = "oktapam_key" | ||
ApiKeySecretKey = "oktapam_secret" | ||
TeamKey = "oktapam_team" | ||
|
||
DefaultAPIBaseURL = "https://app.scaleft.com" | ||
) | ||
|
||
const ( | ||
MySqlBasicAuth = "mysql.basic_auth" | ||
) | ||
|
||
const ( | ||
ProviderADCertificateObjectKey = "oktapam_ad_certificate_object" | ||
ProviderADCertificateRequestKey = "oktapam_ad_certificate_request" | ||
ProviderADConnectionKey = "oktapam_ad_connection" | ||
ProviderADConnectionsKey = "oktapam_ad_connections" | ||
ProviderADTaskSettingsKey = "oktapam_ad_task_settings" | ||
ProviderADUserSyncTaskSettingsKey = "oktapam_ad_user_sync_task_settings" | ||
ProviderADUserSyncTaskSettingsIDListKey = "oktapam_ad_user_sync_task_settings_id_list" | ||
ProviderCurrentUser = "oktapam_current_user" | ||
ProviderDatabaseKey = "oktapam_database" | ||
ProviderDatabasePasswordSettings = "oktapam_database_password_settings" | ||
ProviderGatewaysKey = "oktapam_gateways" | ||
ProviderGatewaySetupTokenKey = "oktapam_gateway_setup_token" | ||
ProviderGatewaySetupTokensKey = "oktapam_gateway_setup_tokens" | ||
ProviderGroupKey = "oktapam_group" | ||
ProviderGroupsKey = "oktapam_groups" | ||
ProviderKubernetesClusterKey = "oktapam_kubernetes_cluster" | ||
ProviderKubernetesClusterConnectionKey = "oktapam_kubernetes_cluster_connection" | ||
ProviderKubernetesClusterGroupKey = "oktapam_kubernetes_cluster_group" | ||
ProviderPasswordSettingsKey = "oktapam_password_settings" | ||
ProviderProjectKey = "oktapam_project" | ||
ProviderProjectsKey = "oktapam_projects" | ||
ProviderProjectGroupKey = "oktapam_project_group" | ||
ProviderProjectGroupsKey = "oktapam_project_groups" | ||
ProviderResourceGroupKey = "oktapam_resource_group" | ||
ProviderResourceGroupsKey = "oktapam_resource_groups" | ||
ProviderResourceGroupProjectKey = "oktapam_resource_group_project" | ||
ProviderResourceGroupProjectsKey = "oktapam_resource_group_projects" | ||
ProviderResourceGroupServerEnrollmentTokenKey = "oktapam_resource_group_server_enrollment_token" | ||
ProviderResourceGroupServerEnrollmentTokensKey = "oktapam_resource_group_server_enrollment_tokens" | ||
ProviderSecretFolderKey = "oktapam_secret_folder" | ||
ProviderSecretFoldersKey = "oktapam_secret_folders" | ||
ProviderSecurityPoliciesKey = "oktapam_security_policies" | ||
ProviderSecurityPolicyKey = "oktapam_security_policy" | ||
ProviderServerEnrollmentTokenKey = "oktapam_server_enrollment_token" | ||
ProviderServerEnrollmentTokensKey = "oktapam_server_enrollment_tokens" | ||
ProviderTeamSettingsKey = "oktapam_team_settings" | ||
ProviderUserGroupAttachmentKey = "oktapam_user_group_attachment" | ||
ProviderUserKey = "oktapam_user" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package oktapam | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/hashicorp/terraform-plugin-framework/provider" | ||
"github.com/hashicorp/terraform-plugin-framework/providerserver" | ||
"github.com/hashicorp/terraform-plugin-go/tfprotov6" | ||
"github.com/hashicorp/terraform-plugin-mux/tf5to6server" | ||
"github.com/hashicorp/terraform-plugin-mux/tf6muxserver" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/okta/terraform-provider-oktapam/oktapam/fwprovider" | ||
"github.com/okta/terraform-provider-oktapam/oktapam/sdkv2" | ||
) | ||
|
||
func ProviderServerFactoryV6(ctx context.Context, sdkV2Provider *schema.Provider, fwProvider *fwprovider.OktapamFrameworkProvider) (func() tfprotov6.ProviderServer, error) { | ||
var v5Provider *schema.Provider | ||
if sdkV2Provider == nil { | ||
v5Provider = sdkv2.Provider() | ||
} else { | ||
v5Provider = sdkV2Provider | ||
} | ||
|
||
var v6Provider provider.Provider | ||
if fwProvider == nil { | ||
v6Provider = fwprovider.New()() | ||
} else { | ||
v6Provider = fwProvider | ||
} | ||
|
||
// SDKV2 used for tf plugin development is designed for maintaining tf plugins that are compatible with Plugin | ||
// Protocol version 5. Plugins need to communicate with Terraform CLI, protocol version 5 is supported by CLI version | ||
// 0.12 and later. Protocol version 6 support tf cli version 1.0 or later. | ||
|
||
// To start using new TF Plugin Framework(https://developer.hashicorp.com/terraform/plugin/framework) we have two options - | ||
// Option 1: Downgrade new plugin framework server to support protocol version 5 | ||
// Option 2: Upgrade old SDKV2 provider server to support protocol version 6 | ||
// If we go with Option 1, then will not be able to use some of the newer features like Nested Attributes: | ||
// https://developer.hashicorp.com/terraform/plugin/framework/handling-data/attributes#nested-attribute-types | ||
|
||
//Going with option 2, that will require upgrading tf cli version to 1.0+. | ||
|
||
// tf5to6server enables translating a protocol version 5 provider server into a protocol version 6 provider server. | ||
upgradedV5Provider, err := tf5to6server.UpgradeServer( | ||
ctx, | ||
v5Provider.GRPCProvider, | ||
) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
// Combine Providers | ||
// Refer: https://developer.hashicorp.com/terraform/plugin/mux/combining-protocol-version-6-providers | ||
providers := []func() tfprotov6.ProviderServer{ | ||
func() tfprotov6.ProviderServer { | ||
return upgradedV5Provider | ||
}, | ||
providerserver.NewProtocol6(v6Provider), | ||
} | ||
|
||
muxServer, err := tf6muxserver.NewMuxServer(ctx, providers...) | ||
if err != nil { | ||
log.Fatal(err) | ||
return nil, err | ||
} | ||
|
||
return muxServer.ProviderServer, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.