Capture "ServiceEndpoint" output as a parameter

Related to, but not explicitly related to other discussions about using the Parameter store, as there’s no circular dependency, so I thought I’d ask:

Currently serverless dynamically creates an API Gateway for functions to reside behind and the resulting CloudFormation template actually returns the endpoint url back as “ServiceEndpoint”. What I’d like to do is store this in the SystemManager Parameter store so I can reference it with other deployments. In a “pure” cloudformation sense it’s exceedingly simple to create such a resource:

Resources:
  ServiceUrlParam:
    Type: "AWS::SSM::Parameter"
    Properties: 
      Name: /SeviceUrl
      Type: String
      Value: !Ref <someresource>

Now in the serverless.yml … isn’t necessarily defined, so while I can add said resource, I have no idea how to populate the endpoint. It’s clearly referenced by the time the cloudformation template is formed (hence the output), but is there an easy way to reference it here?

Note to all that I was able to solve this, due to the fact that serverless uses a consistent name for it’s resources in cloud formation every time. So for those currious, the earlier mentioned example would look like this in the serverless.tml:

resources:
  Resources:
    ServiceUrlParam:
      Type: "AWS::SSM::Parameter"
      Properties: 
        Name: /SeviceUrl
        Type: String
        Value:
          Ref: ApiGatewayRestApi

And bam: now my new service generates a key/value I can reference in other projects easily.

Useful stuff, however in case you want to create a SecureString param it can’t be done with serverless / cloudformation, so it would require some scripting.
Something like:

sls info | sed -n -e 's/^[[:space:]]*your-parameter: \([[:alnum:]]\+\).*/\1/p')