Make service_template flake8 compatible

Change-Id: I5c69015e7233b78a4eacafd29a8e2dd0399ccd66
Fix few issues in service_template

Change creation order - previously there could be
situation where object would be created but it's resource_id was
unset resulting in it being impossible to delete by heat.

Change-Id: Ibdcb7007979e47829ce2f0627e61095ecb0255ed