Learn Idem

Learn Idem

Powered by Idem Project

aws.ec2.security_group

**Autogenerated function**

Deletes a security group. If you attempt to delete a security group that is associated with an instance, or is
referenced by another security group, the operation fails with InvalidGroup.InUse in EC2-Classic or
DependencyViolation in EC2-VPC.

Args:
    name(Text): An Idem name to identify the security group resource.
    resource_id(Text, optional): AWS Security Group ID. Idem automatically considers this resource being absent
     if this field is not specified.

Returns:
    Dict[str, Any]

Examples:

    .. code-block:: sls

        sg-0008bd25b7867b5cf:
          aws.ec2.security_group.absent:
            - name: isolation-securitygroup-84c9a893-844b-40ab-86e8-b565dea88b5d
            - resource_id: id: sg-0008bd25b7867b5cf
Deep copy operation on arbitrary Python objects.

    See the module's __doc__ string for more info.
**Autogenerated function**

Describe the resource in a way that can be recreated/managed with the corresponding "present" function


Describes the specified security groups or all of your security groups. A security group is for use with
instances either in the EC2-Classic platform or in a specific VPC. For more information, see Amazon EC2 security
groups in the Amazon Elastic Compute Cloud User Guide and Security groups for your VPC in the Amazon Virtual
Private Cloud User Guide.


Returns:
    Dict[str, Any]

Examples:

    .. code-block:: bash

        $ idem describe aws.ec2.security_group
**Autogenerated function**

Creates a security group. A security group acts as a virtual firewall for your instance to control inbound and
outbound traffic. For more information, see Amazon EC2 security groups in the Amazon Elastic Compute Cloud User
Guide and Security groups for your VPC in the Amazon Virtual Private Cloud User Guide. When you create a
security group, you specify a friendly name of your choice. You can have a security group for use in EC2-Classic
with the same name as a security group for use in a VPC. However, you can't have two security groups for use in
EC2-Classic with the same name or two security groups for use in a VPC with the same name. You have a default
security group for use in EC2-Classic and a default security group for use in your VPC. If you don't specify a
security group when you launch an instance, the instance is launched into the appropriate default security
group. A default security group includes a default rule that grants instances unrestricted network access to
each other. You can add or remove rules from your security groups using AuthorizeSecurityGroupIngress,
AuthorizeSecurityGroupEgress, RevokeSecurityGroupIngress, and RevokeSecurityGroupEgress. For more information
about VPC security group limits, see Amazon VPC Limits.

Args:
    name(Text): The security group name as set on AWS.
    description(Text): Description of the security group.
    vpc_id(Text): Id of the VPC security group should be attached to.
    resource_id(Text, optional): AWS Security Group ID.
    tags(Dict or List, optional): Dict in the format of {tag-key: tag-value} or List of tags in the format of
        [{"Key": tag-key, "Value": tag-value}] to associate with the security group.
        Each tag consists of a key name and an associated value. Defaults to None.
        * (Key, optional): The key of the tag. Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode
            characters. May not begin with aws:.
        * (Value, optional): The value of the tag. Constraints: Tag values are case-sensitive and accept a maximum of 256
            Unicode characters.

Request Syntax:
    [security_group_id]:
      aws.ec2.security_group.present:
      - resource_id: 'string'
      - name: 'string'
      - vpc_id: 'string'
      - tags:
            - Key: 'string'
              Value: 'string'


Returns:
    Dict[str, Any]

Examples:

    .. code-block:: sls

        isolation-securitygroup-84c9a893-844b-40ab-86e8-b565dea88b5d:
          aws.ec2.security_group.present:
              - resource_id: sg-0008bd25b7867b5cf
              - name: isolation-securitygroup-84c9a893-844b-40ab-86e8-b565dea88b5d
              - vpc_id: vpc-247e9a5d
              - description: sg-description
              - tags:
                    - Key: Name
                      Value: sg-name
                    - Key: sg-tag-key-2
                      Value: sg-tag-value-2
Provides details about a specific Security Group as a data-source. Supply one of the inputs as the filter.

Args:
    name(Text):
         The name of the Idem state.

    resource_id(Text, optional):
        Security Group id to identify the resource.

    filters(list, optional):
        One or more filters: for example, tag :<key>, tag-key. A complete list of filters can be found at
        https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_security_groups

    vpc_id(Text, Optional): Id of the VPC security group attached to.

    tags(List or Dict, Optional): list of tags in the format of [{"Key": tag-key, "Value": tag-value}] or dict in the format of
            {tag-key: tag-value} for security group.

Request Syntax:
    [Idem-state-name]:
      aws.ec2.security_group.search:
          - name: 'string'
          - resource_id: 'string'
          - filters:
            - name: 'string'
              values: 'list'
            - name: 'string'
              values: 'list'
          - vpc_id: 'string'
          - tags:
             - Key: 'string'
               Value: 'string'
Examples:

    .. code-block:: bash

        idem-test-security-group-search:
            aws.ec2.security_group.search:
              - name: idem-test-security-group
              - filters:
                - name: 'group-name'
                  values: ["idem-test-security-group"]
              - vpc_id: vpc-247e9a5d
              - tags:
                - Key: Name
                  Value: sg-name
                - Key: sg-tag-key-2
                  Value: sg-tag-value-2

Full plugin documentation is available on the Idem documentation site - aws.ec2.security_group .

Last updated on 20 Sep 2022
 Edit on GitHub