com.pulumi.aws.vpc.kotlin.SecurityGroupEgressRule.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.vpc.kotlin
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
/**
* Builder for [SecurityGroupEgressRule].
*/
@PulumiTagMarker
public class SecurityGroupEgressRuleResourceBuilder internal constructor() {
public var name: String? = null
public var args: SecurityGroupEgressRuleArgs = SecurityGroupEgressRuleArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend SecurityGroupEgressRuleArgsBuilder.() -> Unit) {
val builder = SecurityGroupEgressRuleArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): SecurityGroupEgressRule {
val builtJavaResource = com.pulumi.aws.vpc.SecurityGroupEgressRule(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return SecurityGroupEgressRule(builtJavaResource)
}
}
/**
* 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
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.vpc.SecurityGroupEgressRule("example", {
* securityGroupId: exampleAwsSecurityGroup.id,
* cidrIpv4: "10.0.0.0/8",
* fromPort: 80,
* ipProtocol: "tcp",
* toPort: 80,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.vpc.SecurityGroupEgressRule("example",
* security_group_id=example_aws_security_group["id"],
* cidr_ipv4="10.0.0.0/8",
* from_port=80,
* ip_protocol="tcp",
* to_port=80)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Vpc.SecurityGroupEgressRule("example", new()
* {
* SecurityGroupId = exampleAwsSecurityGroup.Id,
* CidrIpv4 = "10.0.0.0/8",
* FromPort = 80,
* IpProtocol = "tcp",
* ToPort = 80,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/vpc"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := vpc.NewSecurityGroupEgressRule(ctx, "example", &vpc.SecurityGroupEgressRuleArgs{
* SecurityGroupId: pulumi.Any(exampleAwsSecurityGroup.Id),
* CidrIpv4: pulumi.String("10.0.0.0/8"),
* FromPort: pulumi.Int(80),
* IpProtocol: pulumi.String("tcp"),
* ToPort: pulumi.Int(80),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:vpc:SecurityGroupEgressRule
* properties:
* securityGroupId: ${exampleAwsSecurityGroup.id}
* cidrIpv4: 10.0.0.0/8
* fromPort: 80
* ipProtocol: tcp
* toPort: 80
* ```
*
* ## 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
* ```
*/
public class SecurityGroupEgressRule internal constructor(
override val javaResource: com.pulumi.aws.vpc.SecurityGroupEgressRule,
) : KotlinCustomResource(javaResource, SecurityGroupEgressRuleMapper) {
/**
* The Amazon Resource Name (ARN) of the security group rule.
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* The destination IPv4 CIDR range.
*/
public val cidrIpv4: Output?
get() = javaResource.cidrIpv4().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The destination IPv6 CIDR range.
*/
public val cidrIpv6: Output?
get() = javaResource.cidrIpv6().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The security group rule description.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
*/
public val fromPort: Output?
get() = javaResource.fromPort().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* 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 val ipProtocol: Output
get() = javaResource.ipProtocol().applyValue({ args0 -> args0 })
/**
* The ID of the destination prefix list.
*/
public val prefixListId: Output?
get() = javaResource.prefixListId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The destination security group that is referenced in the rule.
*/
public val referencedSecurityGroupId: Output?
get() = javaResource.referencedSecurityGroupId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The ID of the security group.
*/
public val securityGroupId: Output
get() = javaResource.securityGroupId().applyValue({ args0 -> args0 })
/**
* The ID of the security group rule.
*/
public val securityGroupRuleId: Output
get() = javaResource.securityGroupRuleId().applyValue({ args0 -> args0 })
/**
* 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 val tags: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy