kind-minister-39119
03/13/2020, 1:11 AMget_vpc
and get_subnet
, but aws.ec2.Instance
does not give me the opportunity to specify a VPC ID. The result is when I specify the subnet, I get this error:
aws:ec2:Instance (ansible-master):
error: Error launching source instance: InvalidGroup.NotFound: The security group 'mgmt-ansible-master-sg-xxxx' does not exist in VPC 'vpc-xxxxxx'
status code: 400, request id: xxxxx
vpc = aws.ec2.get_vpc(cidr_block="172.18.0.0/16")
subnet = aws.ec2.get_subnet(vpc_id=vpc.id, cidr_block="172.18.1.0/24")
group = aws.ec2.SecurityGroup('mgmt-ansible-master-sg',
description='Ansible Master Security Group',
ingress=[
{ 'protocol': 'tcp', 'from_port': 22, 'to_port': 22, 'cidr_blocks': ['172.18.0.0/24'] }
],
egress=[
{ 'protocol': '-1', 'from_port': 0, 'to_port': 0, 'cidr_blocks': ['0.0.0.0/0'] }
], vpc_id=vpc.id)
server = aws.ec2.Instance("ansible-master",
instance_type=size,
security_groups=[group.name],
ami=ami.id, key_name='mgmt', subnet_id=subnet.id)
colossal-ram-89482
03/13/2020, 2:47 AMvpc_security_group_ids
instead of security_groups