All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.vpc.SecurityGroupEgressRule Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

There is a newer version: 6.66.3
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.aws.vpc;

import com.pulumi.aws.Utilities;
import com.pulumi.aws.vpc.SecurityGroupEgressRuleArgs;
import com.pulumi.aws.vpc.inputs.SecurityGroupEgressRuleState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Integer;
import java.lang.String;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages an outbound (egress) rule for a security group.
 * 
 * When specifying an outbound rule for your security group in a VPC, the configuration must include a destination for the traffic.
 * 
 * > **NOTE:** Using `aws.vpc.SecurityGroupEgressRule` and `aws.vpc.SecurityGroupIngressRule` resources is the current best practice. Avoid using the `aws.ec2.SecurityGroupRule` resource and the `ingress` and `egress` arguments of the `aws.ec2.SecurityGroup` resource for configuring in-line rules, as they struggle with managing multiple CIDR blocks, and tags and descriptions due to the historical lack of unique IDs.
 * 
 * !> **WARNING:** You should not use the `aws.vpc.SecurityGroupEgressRule` and `aws.vpc.SecurityGroupIngressRule` resources in conjunction with the `aws.ec2.SecurityGroup` resource with _in-line rules_ (using the `ingress` and `egress` arguments of `aws.ec2.SecurityGroup`) or the `aws.ec2.SecurityGroupRule` resource. Doing so may cause rule conflicts, perpetual differences, and result in rules being overwritten.
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.vpc.SecurityGroupEgressRule;
 * import com.pulumi.aws.vpc.SecurityGroupEgressRuleArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         var example = new SecurityGroupEgressRule("example", SecurityGroupEgressRuleArgs.builder()
 *             .securityGroupId(exampleAwsSecurityGroup.id())
 *             .cidrIpv4("10.0.0.0/8")
 *             .fromPort(80)
 *             .ipProtocol("tcp")
 *             .toPort(80)
 *             .build());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## Import * * Using `pulumi import`, import security group egress rules using the `security_group_rule_id`. For example: * * ```sh * $ pulumi import aws:vpc/securityGroupEgressRule:SecurityGroupEgressRule example sgr-02108b27edd666983 * ``` * */ @ResourceType(type="aws:vpc/securityGroupEgressRule:SecurityGroupEgressRule") public class SecurityGroupEgressRule extends com.pulumi.resources.CustomResource { /** * The Amazon Resource Name (ARN) of the security group rule. * */ @Export(name="arn", refs={String.class}, tree="[0]") private Output arn; /** * @return The Amazon Resource Name (ARN) of the security group rule. * */ public Output arn() { return this.arn; } /** * The destination IPv4 CIDR range. * */ @Export(name="cidrIpv4", refs={String.class}, tree="[0]") private Output cidrIpv4; /** * @return The destination IPv4 CIDR range. * */ public Output> cidrIpv4() { return Codegen.optional(this.cidrIpv4); } /** * The destination IPv6 CIDR range. * */ @Export(name="cidrIpv6", refs={String.class}, tree="[0]") private Output cidrIpv6; /** * @return The destination IPv6 CIDR range. * */ public Output> cidrIpv6() { return Codegen.optional(this.cidrIpv6); } /** * The security group rule description. * */ @Export(name="description", refs={String.class}, tree="[0]") private Output description; /** * @return The security group rule description. * */ public Output> description() { return Codegen.optional(this.description); } /** * The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type. * */ @Export(name="fromPort", refs={Integer.class}, tree="[0]") private Output fromPort; /** * @return The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type. * */ public Output> fromPort() { return Codegen.optional(this.fromPort); } /** * The IP protocol name or number. Use `-1` to specify all protocols. Note that if `ip_protocol` is set to `-1`, it translates to all protocols, all port ranges, and `from_port` and `to_port` values should not be defined. * */ @Export(name="ipProtocol", refs={String.class}, tree="[0]") private Output ipProtocol; /** * @return The IP protocol name or number. Use `-1` to specify all protocols. Note that if `ip_protocol` is set to `-1`, it translates to all protocols, all port ranges, and `from_port` and `to_port` values should not be defined. * */ public Output ipProtocol() { return this.ipProtocol; } /** * The ID of the destination prefix list. * */ @Export(name="prefixListId", refs={String.class}, tree="[0]") private Output prefixListId; /** * @return The ID of the destination prefix list. * */ public Output> prefixListId() { return Codegen.optional(this.prefixListId); } /** * The destination security group that is referenced in the rule. * */ @Export(name="referencedSecurityGroupId", refs={String.class}, tree="[0]") private Output referencedSecurityGroupId; /** * @return The destination security group that is referenced in the rule. * */ public Output> referencedSecurityGroupId() { return Codegen.optional(this.referencedSecurityGroupId); } /** * The ID of the security group. * */ @Export(name="securityGroupId", refs={String.class}, tree="[0]") private Output securityGroupId; /** * @return The ID of the security group. * */ public Output securityGroupId() { return this.securityGroupId; } /** * The ID of the security group rule. * */ @Export(name="securityGroupRuleId", refs={String.class}, tree="[0]") private Output securityGroupRuleId; /** * @return The ID of the security group rule. * */ public Output securityGroupRuleId() { return this.securityGroupRuleId; } /** * A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block. * * @deprecated * Please use `tags` instead. * */ @Deprecated /* Please use `tags` instead. */ @Export(name="tagsAll", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tagsAll; /** * @return A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block. * */ public Output> tagsAll() { return this.tagsAll; } /** * The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. * */ @Export(name="toPort", refs={Integer.class}, tree="[0]") private Output toPort; /** * @return The end of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code. * */ public Output> toPort() { return Codegen.optional(this.toPort); } /** * * @param name The _unique_ name of the resulting resource. */ public SecurityGroupEgressRule(java.lang.String name) { this(name, SecurityGroupEgressRuleArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public SecurityGroupEgressRule(java.lang.String name, SecurityGroupEgressRuleArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public SecurityGroupEgressRule(java.lang.String name, SecurityGroupEgressRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:vpc/securityGroupEgressRule:SecurityGroupEgressRule", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private SecurityGroupEgressRule(java.lang.String name, Output id, @Nullable SecurityGroupEgressRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("aws:vpc/securityGroupEgressRule:SecurityGroupEgressRule", name, state, makeResourceOptions(options, id), false); } private static SecurityGroupEgressRuleArgs makeArgs(SecurityGroupEgressRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? SecurityGroupEgressRuleArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static SecurityGroupEgressRule get(java.lang.String name, Output id, @Nullable SecurityGroupEgressRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new SecurityGroupEgressRule(name, id, state, options); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy