Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Security group not found in VPC #191

Open
@hundredacres

Description

@hundredacres

I'm receiving an error when trying declare a instance in a VPC subnet

[root@admin1001 ~]# puppet agent -t
Warning: Setting modulepath is deprecated in puppet.conf. See http://links.puppetlabs.com/env-settings-deprecations
   (at /usr/local/rvm/gems/ruby-1.9.3-p551/gems/puppet-3.8.1/lib/puppet/settings.rb:1141:in `issue_deprecation_warning')
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for admin1001.usw2
Info: Applying configuration version '1435777315'
Info: Checking if VPC USW1 exists in us-west-1
Info: Checking if subnet Admin subnet exists in us-west-1
Notice: Using ec2 data and code
Notice: /Stage[main]/Main/Notify[Environment]/message: defined 'message' as 'Using ec2 data and code'
Info: Checking if subnet DB subnet exists in us-west-1
Info: Checking if security group mysql exists in region us-west-1
Info: Creating security group mysql in region us-west-1
Notice: /Stage[main]/Riskiq::Dr::Mysql/Ec2_securitygroup[mysql]/ensure: created
Info: Checking if instance db1001.usw2 is running in region us-west-1
Info: Checking if instance db1001.usw2 is stopped in region us-west-1
Info: Starting instance db1001.usw2 in region us-west-1
Error: Security groups 'mysql' not found in VPCs 'vpc-5c7f643e'
Error: /Stage[main]/Riskiq::Dr::Mysql/Ec2_instance[db1001.usw2]/ensure: change from absent to present failed: Security groups 'mysql' not found in VPCs 'vpc-5c7f643e'
Notice: Finished catalog run in 3.75 seconds

Below is part of the manifest that sets up the security group and the instance.

ec2_securitygroup { 'mysql':
    ensure      => $ensure,
    description => 'Security group for mysql instances',
    region      => $region,
    vpc         => $vpc,
    tags        => {
      'Name' => 'mysql'
    },
    ingress     => [{
      protocol => 'tcp',
      port     => 3306,
      cidr     => '0.0.0.0/0',
    }],
}
ec2_instance { 'db1001.usw2':
    ensure            => $ensure,
    region            => $region,
    availability_zone => $avail_zone,
    image_id          => 'ami-57cfc412',
    security_groups   => ['mysql'],
    instance_type     => 't2.medium',
    key_name          => 'riskiq-primary',
    subnet            => 'DB Subnet',
    tags              => {
      'Name' => 'db1001.usw2',
    },
}

When I query the ec2_securitygroup resource, I get back results that imply the security group is assigned to the VPN

[root@admin1001 ~]# puppet resource ec2_securitygroup mysql
Warning: Setting modulepath is deprecated in puppet.conf. See http://links.puppetlabs.com/env-settings-deprecations
   (at /usr/local/rvm/gems/ruby-1.9.3-p551/gems/puppet-3.8.1/lib/puppet/settings.rb:1141:in `issue_deprecation_warning')
ec2_securitygroup { 'mysql':
  ensure      => 'present',
  description => 'Security group for mysql instances',
  ingress     => [{'cidr' => '0.0.0.0/0', 'from_port' => '3306', 'protocol' => 'tcp', 'to_port' => '3306'}],
  region      => 'us-west-1',
  vpc         => 'USW1',
}

I'm missing something, but not sure what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions