Hi, the terraform.py script linked from https://docs.nrec.no/terraform-part4.html#ansible-inventory-from-terraform-state contains the following:
default_root = os.environ.get('TERRAFORM_STATE_ROOT',
os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', )))
When following the instructions for linking it as inventory/hosts of the terraform working directory, ansible all -i inventory --list-hosts will also pick up hosts from the .tfstate files of sibling directories of the current directory (since default_root will be the parent directory of the current directory).
As a workaround, one can add the line export TERRAFORM_STATE_ROOT=$(pwd) to keystone_rc.sh.