Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Lack of public_ip causes failure #16

Open
@plombardi89

Description

@plombardi89

Receiving this error:

Traceback (most recent call last):
File "./terraform.py", line 562, in
main()
File "./terraform.py", line 547, in main
output = query_list(hosts)
File "./terraform.py", line 489, in query_list
for name, attrs, hostgroups in hosts:
File "./terraform.py", line 68, in iterhosts
yield parser(resource, module_name)
File "./terraform.py", line 84, in inner
name, attrs, groups = func(_args, *_kwargs)
File "./terraform.py", line 330, in aws_host
'ansible_ssh_host': raw_attrs['public_ip'],
KeyError: u'public_ip'

Which is I believe due to the fact I have an instance without a public_ip (living in a private network):

"attributes": {
    "ami": "ami-96a818fe",
    "availability_zone": "us-east-1a",
    "ebs_block_device.#": "0",
    "ebs_optimized": "false",
    "ephemeral_block_device.#": "0",
    "id": "i-57efa6f7",
    "instance_type": "t2.micro",
    "key_name": "REDACTED",
    "monitoring": "false",
    "private_dns": "ip-10-0-10-213.ec2.internal",
    "private_ip": "10.0.10.213",
    "public_dns": "",
    "root_block_device.#": "1",
    "root_block_device.0.delete_on_termination": "false",
    "root_block_device.0.iops": "0",
    "root_block_device.0.volume_size": "8",
    "root_block_device.0.volume_type": "standard",
    "security_groups.#": "1",
    "security_groups.112399896": "sg-49b1572f",
    "source_dest_check": "true",
    "subnet_id": "subnet-53b88d0a",
    "tags.#": "3",
    "tags.Environment": "internal",
    "tags.Name": "jenkins_master",
    "tags.Owner": "rnd",
    "tenancy": "default",
    "vpc_security_group_ids.#": "1",
    "vpc_security_group_ids.112399896": "sg-49b1572f"
}

Not quite sure how you want to solve that problem, but perhaps just ignore instances in .tfstate files if there is no public_ip?

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions