Skip to content

Commit

Permalink
Feat: add new OIDC credentials creation and assigment (gcp resource) (#…
Browse files Browse the repository at this point in the history
…782)

* Feat: add new OIDC credentials creation and assigment (gcp resource)

* added missing omitempty

* Fixed example

* fix test

* fix mixup between examples
  • Loading branch information
TomerHeber committed Jan 14, 2024
1 parent 92c71c2 commit fb6bde6
Show file tree
Hide file tree
Showing 14 changed files with 505 additions and 245 deletions.
6 changes: 4 additions & 2 deletions client/cloud_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ type GcpCredentialsCreatePayload struct {
}

type GcpCredentialsValuePayload struct {
ProjectId string `json:"projectId"`
ServiceAccountKey string `json:"serviceAccountKey"`
ProjectId string `json:"projectId,omitempty"`
ServiceAccountKey string `json:"serviceAccountKey,omitempty"`
CredentialConfigurationFileContent string `json:"credentialConfigurationFileContent,omitempty"`
}

func (c *GoogleCostCredentialsCreatePayload) SetOrganizationId(organizationId string) {
Expand All @@ -102,6 +103,7 @@ const (
AwsOidcCredentialsType AwsCredentialsType = "AWS_OIDC"
GoogleCostCredentialsType GcpCredentialsType = "GCP_CREDENTIALS"
GcpServiceAccountCredentialsType GcpCredentialsType = "GCP_SERVICE_ACCOUNT_FOR_DEPLOYMENT"
GcpOidcCredentialsType GcpCredentialsType = "GCP_OIDC"
AzureCostCredentialsType AzureCredentialsType = "AZURE_CREDENTIALS"
AzureServicePrincipalCredentialsType AzureCredentialsType = "AZURE_SERVICE_PRINCIPAL_FOR_DEPLOYMENT"
AzureOidcCredentialsType AzureCredentialsType = "AZURE_OIDC"
Expand Down
2 changes: 2 additions & 0 deletions env0/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
AZURE_COST_TYPE CloudType = "azure_cost"
AZURE_OIDC_TYPE CloudType = "azure_oidc"
GCP_TYPE CloudType = "gcp"
GCP_OIDC_TYPE CloudType = "gcp_oidc"
GCP_COST_TYPE CloudType = "google_cost"
)

Expand All @@ -34,6 +35,7 @@ var credentialsTypeToPrefixList map[CloudType][]string = map[CloudType][]string{
AZURE_OIDC_TYPE: {string(client.AzureOidcCredentialsType)},
GCP_TYPE: {string(client.GcpServiceAccountCredentialsType)},
GCP_COST_TYPE: {string(client.GoogleCostCredentialsType)},
GCP_OIDC_TYPE: {string(client.GcpOidcCredentialsType)},
}

func getCredentialsByName(name string, prefixList []string, meta interface{}) (client.Credentials, error) {
Expand Down
119 changes: 0 additions & 119 deletions env0/data_aws_oidc_credentials_test.go

This file was deleted.

119 changes: 0 additions & 119 deletions env0/data_azure_oidc_credentials_test.go

This file was deleted.

Loading

0 comments on commit fb6bde6

Please sign in to comment.