Skip to content

Better documentation for EC2 securityGroups and securityGroupIds #44

Open
@nh2

Description

@nh2

Right now we have:

    deployment.ec2.securityGroups = mkOption {
      default = [ "default" ];
      example = [ "my-group" "my-other-group" ];
      type = types.listOf (types.either types.str (resource "ec2-security-group"));
      apply = map (x: if builtins.isString x then x else x.name);
      description = ''
        Security groups for the instance.  These determine the
        firewall rules applied to the instance.
      '';
    };

    deployment.ec2.securityGroupIds = mkOption {
      default = [ "default" ];
      type = types.listOf types.str;
      description = ''
        Security Group IDs for the instance. Necessary if starting
        an instance inside a VPC/subnet. In the non-default VPC, security
        groups needs to be specified by ID and not name.
      '';
    };

This is hard to understand. In which cases should I used securityGroups, and in which securityGroupIds?

  • The docs of the latter say Necessary if starting an instance inside a VPC/subnet but that seems wrong: Using securityGroups = ["nixops"] after having declared a resources.ec2SecurityGroups."nixops".name = "nixops" works.
  • If I do deployment.ec2.securityGroupIds = ["nixops"] or even ["garbage"], then it uses the default security group instead of complaining. Is that intended?
  • We should add some examples, ideally also one that shows how to use the type resource "ec2-security-group" approach, referring to a resources.ec2SecurityGroups. And also an example to make super clear that securityGroupIds should probably start with sg-.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions