# ec2\_group\_facts not using my fact

**URL:** <https://forum.ansible.com/t/ec2-group-facts-not-using-my-fact/25937>\
**Category:** Ansible Project\
**Created:** [November 6, 2017, 12:19pm UTC](https://forum.ansible.com/t/ec2-group-facts-not-using-my-fact/25937 "2017-11-06T12:19:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayeola](https://avatars.discourse-cdn.com/v4/letter/j/e495f1/32.png) [@jayeola](https://forum.ansible.com/u/jayeola)\
**Post date:** [November 6, 2017, 12:19pm UTC](https://forum.ansible.com/t/ec2-group-facts-not-using-my-fact/25937/1 "2017-11-06T12:19:37Z")

</div>

Hey chaps,

Is there any reason why “ec2\_group\_facts” is not using my fact? Can ec2\_group\_facts use defined facts?

- name: Get vpc details  
ec2\_vpc\_net\_facts:  
region: “{{new\_region}}”  
filters:  
“tag:Name”: “blah\*”  
register: result

- name: Define VPC ID  
set\_fact:  
new\_vpcID: result.vpcs[0][‘id’]

- debug: var=“{{new\_vpcID}}”

- name: Get SG in new VPC  
ec2\_group\_facts:  
filters:  
vpc-id: “{{new\_vpcID}}”

So I can get the existing VPC…

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /blah/blah/projects/query\_network.yml:13  
Monday 06 November 2017 12:07:34 +0000 (0:00:00.033) 0:00:00.753 \*\*\*\*\*\*\*  
ok: [localhost] =\> {  
“result.vpcs[0][‘id’]”: “vpc-c8f8f2a0”  
}

But why is the filter “Get SG in new VPC” not getting any results?

TASK [Get SG in new VPC] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /blah/blah/projects/query\_network.yml:15  
Monday 06 November 2017 12:07:34 +0000 (0:00:00.036) 0:00:00.789 \*\*\*\*\*\*\*  
ok: [localhost] =\> {“changed”: false, “failed”: false, “security\_groups”: }  
META: ran handlers  
META: ran handlers
