Extending SLS in SaltStack

This post helps you in Extending SLS files in SaltStack, Whereas a use or use_in requisite will copy defaults to or from another state, the extend block will only modify the state that has been extended.

cat /srv/generic_apache/init.sls
apache2_conf:
file:
managed
name: /etc/apache2/apache2.conf
source: salt://apache2/apache2.conf

(In django_server/init.sls)
include:
generic_apache
extend:
apache2_conf:
file:
source: salt://django/apache2.conf

(In image_server/init.sls)
include:
generic_apache
extend:
apache2_conf:
file: source: salt://django/apache2.conf