Skip to content

Commit

Permalink
Require the profile to be included in requests
Browse files Browse the repository at this point in the history
  • Loading branch information
deedubs committed Oct 12, 2018
1 parent 4c3555e commit 00be713
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ type LambdaConfig struct {

//Config configures the lambada ca client
type Config struct {
Lambda LambdaConfig
Name string
Lambda LambdaConfig `json:"lambda,omitempty"`
Name string `json:"name,omitempty"`
Profile string `json:"profile,omitempty"`
}

//CertificateDetails details of the request
Expand Down Expand Up @@ -60,7 +61,7 @@ func New(cfg Config) Client {
//FetchCa Request a signed certificate
func (c Client) FetchCa() ([]byte, error) {
log.WithFields(log.Fields{"f": "FetchCa"}).Info("Fetching CA Certificate")
resp, err := c.lambdaSvc.Invoke(&lambda.InvokeInput{FunctionName: aws.String("slssl-"+c.config.Name+"-ca")})
resp, err := c.lambdaSvc.Invoke(&lambda.InvokeInput{FunctionName: aws.String("slssl-"+c.config.Name)})
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -109,7 +110,7 @@ func (c Client) RequestCertificate(details CertificateDetails) (csrPEM []byte, k
return nil, nil, nil, err
}

resp, err := c.lambdaSvc.Invoke(&lambda.InvokeInput{FunctionName: aws.String("slssl-"+c.config.Name+"-sign"), Payload: req})
resp, err := c.lambdaSvc.Invoke(&lambda.InvokeInput{FunctionName: aws.String("slssl-"+c.config.Name+"-sign-"+ c.config.Profile), Payload: req})
if err != nil {
return nil, nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/ca/lambda.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_lambda_function" "ca" {
function_name = "slssl-${var.ca_name}-ca"
function_name = "slssl-${var.ca_name}"
handler = "get_ca"
role = "${aws_iam_role.ca.arn}"
runtime = "go1.x"
Expand Down

0 comments on commit 00be713

Please sign in to comment.