def _encode_name(self, name):
        """
        GCP enforces strict resource naming policies (regex
        '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?'), so we work around it by naming
        the stack with a hash.

        """
        digest = hashlib.sha1(b(name)).hexdigest()
        return '%s%s' % (self.deployment_name_prefix, digest)