def create_security_group(self):  # noqa
        """Send a POST to spinnaker to create or update a security group.

        Returns:
            boolean: True if created successfully

        Raises:
            ForemastConfigurationFileError: Missing environment configuration or
                misconfigured Security Group definition.
        """
        ingress_rules = []

        try:
            security_id = get_security_group_id(name=self.app_name, env=self.env, region=self.region)
        except (SpinnakerSecurityGroupError, AssertionError):
            self._create_security_group(ingress_rules)
        else:
            self.log.debug('Security Group ID %s found for %s.', security_id, self.app_name)

        try:
            ingress = self.update_default_rules()
        except KeyError:
            msg = 'Possible missing configuration for "{0}".'.format(self.env)
            self.log.error(msg)
            raise ForemastConfigurationFileError(msg)

        for app in ingress:
            rules = ingress[app]

            # Essentially we have two formats: simple, advanced
            # - simple: is just a list of ports
            # - advanced: selects ports ranges and protocols
            for rule in rules:
                ingress_rule = self.create_ingress_rule(app, rule)
                ingress_rules.append(ingress_rule)

        ingress_rules_no_cidr, ingress_rules_cidr = self._process_rules(ingress_rules)

        self._create_security_group(ingress_rules_no_cidr)

        # Append cidr rules
        self.add_cidr_rules(ingress_rules_cidr)

        # Tag security group
        self.add_tags()

        self.log.info('Successfully created %s security group', self.app_name)
        return True
Send a POST to spinnaker to create or update a security group.

        Returns:
            boolean: True if created successfully

        Raises:
            ForemastConfigurationFileError: Missing environment configuration or
                misconfigured Security Group definition.