Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.

Export fails when referring to the security group of the other account #17

Open
muramasa64 opened this issue Aug 1, 2015 · 1 comment

Comments

@muramasa64
Copy link
Contributor

Classic EC2のSecurityGroupで、他のアカウントのSecurityGroupを参照している状態でexportしようとすると、エラーになります。

例えば、下記のようなSecurityGroupがある場合(AWS Account Numberはmaskしてます)

% aws ec2 describe-security-groups
{
    "SecurityGroups": [
        {
            "IpPermissionsEgress": [],
            "Description": "default group",
            "IpPermissions": [
                {
                    "PrefixListIds": [],
                    "FromPort": 22,
                    "IpRanges": [],
                    "ToPort": 22,
                    "IpProtocol": "tcp",
                    "UserIdGroupPairs": [
                        {
                            "GroupName": "monitor",
                            "UserId": "111111111111",
                            "GroupId": "sg-b4e05eb5"
                        }
                    ]
                }
            ],
            "GroupName": "default",
            "OwnerId": "000000000000",
            "GroupId": "sg-98a62799"
        }
}

このようなエラーになります。

% piculet -e --region ap-northeast-1
[ERROR] The security group 'sg-b4e05eb5' does not exist

詳細なスタックトレース

/home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/core/client.rb:375:in `return_or_raise': The security group 'sg-b4e05eb5' does not exist (AWS::EC2::Errors::InvalidGroup::NotFound)
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/core/client.rb:476:in `client_request'
    from (eval):3:in `describe_security_groups'
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/ec2/resource.rb:72:in `describe_call'
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/ec2/resource.rb:56:in `get_resource'
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/core/resource.rb:235:in `block (2 levels) in define_attribute_getter'
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/core/cacheable.rb:63:in `retrieve_attribute'
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/ec2/resource.rb:66:in `retrieve_attribute'
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/core/resource.rb:235:in `block in define_attribute_getter'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/ext/security-group.rb:14:in `name'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:60:in `block (2 levels) in export_ip_permissions'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:57:in `map'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:57:in `block in export_ip_permissions'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:52:in `map'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:52:in `export_ip_permissions'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:44:in `export_security_group'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:31:in `block in export'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:22:in `each'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:22:in `export'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/exporter.rb:5:in `export'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/client.rb:18:in `block in export'
    from /home/vagrant/.gem/ruby/gems/aws-sdk-v1-1.64.0/lib/aws/core.rb:598:in `memoize'
    from /home/vagrant/.gem/ruby/gems/piculet-0.2.8/lib/piculet/client.rb:17:in `export'
    from /home/vagrant/.gem/ruby/gems/sgupdater-0.2.0/lib/sgupdater/updater.rb:14:in `initialize'
    from /home/vagrant/.gem/ruby/gems/sgupdater-0.2.0/lib/sgupdater/client.rb:28:in `new'
    from /home/vagrant/.gem/ruby/gems/sgupdater-0.2.0/lib/sgupdater/client.rb:28:in `add'
    from /home/vagrant/.gem/ruby/gems/sgupdater-0.2.0/lib/sgupdater/cli.rb:34:in `add'
    from /home/vagrant/.gem/ruby/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /home/vagrant/.gem/ruby/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /home/vagrant/.gem/ruby/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /home/vagrant/.gem/ruby/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /home/vagrant/.gem/ruby/gems/sgupdater-0.2.0/exe/sgupdater:5:in `<top (required)>'
    from /home/vagrant/bin/sgupdater:23:in `load'
    from /home/vagrant/bin/sgupdater:23:in `<main>'
@winebarrel
Copy link
Collaborator

すいません、対応はしばらく先になりそうです

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants