Skip to content

Commit

Permalink
Endpoints for HCP Terraform integration
Browse files Browse the repository at this point in the history
To enable/configure the HCP Terraform integration, we need to create an
API Key to hold the user's authorization. To capture the authorization
this will go through the same redirect lap as `apikeys.CreateAPIKey` does.
To facilitate code-reuse, `CreateHcpConfig` re-uses the messages from the
former and will pass through the request internally.
  • Loading branch information
DavidS-ovm committed Jul 30, 2024
1 parent 069a238 commit 8bb36d1
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions config.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
syntax = "proto3";

package config;

import "apikeys.proto";

option go_package = "github.com/overmindtech/sdp-go;sdp";

// a simple key-value store to store configuration data for accounts and users (TODO)
Expand All @@ -9,6 +12,13 @@ service ConfigurationService {
rpc GetAccountConfig(GetAccountConfigRequest) returns (GetAccountConfigResponse);
// Update the account config for the user's account
rpc UpdateAccountConfig(UpdateAccountConfigRequest) returns (UpdateAccountConfigResponse);

// Create a new HCP Terraform config for the user's account. This follows
// the same flow as CreateAPIKey, to create a new API key that is then used
// for the HCP Terraform endpoint URL.
rpc CreateHcpConfig(CreateHcpConfigRequest) returns (CreateHcpConfigResponse);
// Get the existing HCP Terraform config for the user's account.
rpc GetHcpConfig(GetHcpConfigRequest) returns (GetHcpConfigResponse);
}

// The config that is used when calculating the blast radius for a change, this
Expand Down Expand Up @@ -67,3 +77,28 @@ message UpdateAccountConfigRequest {
message UpdateAccountConfigResponse {
AccountConfig config = 1;
}

message CreateHcpConfigRequest {
// The URL that the user should be redirected to after the whole process is
// over. This should be a page in the frontend, probably the HCP Terraform
// Integration page.
string finalFrontendRedirect = 1;
}

message CreateHcpConfigResponse {
HcpConfig config = 1;
apikeys.CreateAPIKeyResponse apiKey = 2;
}

message HcpConfig {
// the Endpoint URL for the HCP Run Task configuration
string endpoint = 1;
// the HMAC secret for the HCP Run Task configuration
string secret = 2;
}

message GetHcpConfigRequest {}

message GetHcpConfigResponse {
HcpConfig config = 1;
}

0 comments on commit 8bb36d1

Please sign in to comment.