service-cloud-voice / ServiceCloudVoiceLambdas

This application provides a set of Lambda functions, which are available within your Amazon Connect instance after provisioning the instance with your Service Cloud Voice contact center. You can use these Lambdas in Amazon Connect contact flows.
BSD 3-Clause "New" or "Revised" License
14 stars 18 forks source link

parameterize sf auth endpoint and rest api #39

Closed vgw-chriskruger closed 11 months ago

vgw-chriskruger commented 1 year ago

DESCRIPTION

This PR adds the ability to configure the InvokeSalesforceRestApiFunction with organisation specific AUTH and REST API endpoints at the time of stack initiation rather than have to configure these values post deployment. The original defaults are kept.

This makes it easier to configure everything at stack initiation time and drive everything from infrastructure as code tools like terraform, pulumi etc.

By way of example; here is a Terraform use case. Referencing https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/serverlessapplicationrepository_cloudformation_stack

We can see how easily one can spin up this Cloud Formation stack from SAR with the correct parameters in an Infrastructure as Code paradigm.

resource "aws_serverlessapplicationrepository_cloudformation_stack" "service_cloud_voice" {
  name           = "ServiceCloudVoice"
  application_id = "arn:aws:serverlessrepo:us-east-1:317368162107:applications/ServiceCloudVoiceLambdas"
  capabilities = [
    "CAPABILITY_NAMED_IAM",
    "CAPABILITY_RESOURCE_POLICY",
  ]
  parameters = {
    SalesforceOrgId                = var.salesforce_org_id
    SalesforceS3BucketForVoiceMail = var.s3_voice_mail_bucket_name
    ConnectInstanceId              = var.connect_instance_id
    SalesforceAuthEndpoint     =  var.salesforce_auth_endpoint
    SalesforceRestApiEndpointBase = var.salesforce_rest_api_endpoint_base
  }
  semantic_version = "12.0.0"
  tags             = var.tags
}