opentelekomcloud.NetworkingPortSecgroupAssociateV2
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as opentelekomcloud from "@pulumi/opentelekomcloud";
const systemPort = opentelekomcloud.getNetworkingPortV2({
fixedIp: "10.0.0.10",
});
const secgroup = opentelekomcloud.getNetworkingSecgroupV2({
name: "secgroup",
});
const port1 = new opentelekomcloud.NetworkingPortSecgroupAssociateV2("port1", {
portId: systemPort.then(systemPort => systemPort.id),
securityGroupIds: [secgroup.then(secgroup => secgroup.id)],
});
import pulumi
import pulumi_opentelekomcloud as opentelekomcloud
system_port = opentelekomcloud.get_networking_port_v2(fixed_ip="10.0.0.10")
secgroup = opentelekomcloud.get_networking_secgroup_v2(name="secgroup")
port1 = opentelekomcloud.NetworkingPortSecgroupAssociateV2("port1",
port_id=system_port.id,
security_group_ids=[secgroup.id])
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/opentelekomcloud/opentelekomcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
systemPort, err := opentelekomcloud.LookupNetworkingPortV2(ctx, &opentelekomcloud.LookupNetworkingPortV2Args{
FixedIp: pulumi.StringRef("10.0.0.10"),
}, nil)
if err != nil {
return err
}
secgroup, err := opentelekomcloud.LookupNetworkingSecgroupV2(ctx, &opentelekomcloud.LookupNetworkingSecgroupV2Args{
Name: pulumi.StringRef("secgroup"),
}, nil)
if err != nil {
return err
}
_, err = opentelekomcloud.NewNetworkingPortSecgroupAssociateV2(ctx, "port1", &opentelekomcloud.NetworkingPortSecgroupAssociateV2Args{
PortId: pulumi.String(systemPort.Id),
SecurityGroupIds: pulumi.StringArray{
pulumi.String(secgroup.Id),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opentelekomcloud = Pulumi.Opentelekomcloud;
return await Deployment.RunAsync(() =>
{
var systemPort = Opentelekomcloud.GetNetworkingPortV2.Invoke(new()
{
FixedIp = "10.0.0.10",
});
var secgroup = Opentelekomcloud.GetNetworkingSecgroupV2.Invoke(new()
{
Name = "secgroup",
});
var port1 = new Opentelekomcloud.NetworkingPortSecgroupAssociateV2("port1", new()
{
PortId = systemPort.Apply(getNetworkingPortV2Result => getNetworkingPortV2Result.Id),
SecurityGroupIds = new[]
{
secgroup.Apply(getNetworkingSecgroupV2Result => getNetworkingSecgroupV2Result.Id),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opentelekomcloud.OpentelekomcloudFunctions;
import com.pulumi.opentelekomcloud.inputs.GetNetworkingPortV2Args;
import com.pulumi.opentelekomcloud.inputs.GetNetworkingSecgroupV2Args;
import com.pulumi.opentelekomcloud.NetworkingPortSecgroupAssociateV2;
import com.pulumi.opentelekomcloud.NetworkingPortSecgroupAssociateV2Args;
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) {
final var systemPort = OpentelekomcloudFunctions.getNetworkingPortV2(GetNetworkingPortV2Args.builder()
.fixedIp("10.0.0.10")
.build());
final var secgroup = OpentelekomcloudFunctions.getNetworkingSecgroupV2(GetNetworkingSecgroupV2Args.builder()
.name("secgroup")
.build());
var port1 = new NetworkingPortSecgroupAssociateV2("port1", NetworkingPortSecgroupAssociateV2Args.builder()
.portId(systemPort.applyValue(getNetworkingPortV2Result -> getNetworkingPortV2Result.id()))
.securityGroupIds(secgroup.applyValue(getNetworkingSecgroupV2Result -> getNetworkingSecgroupV2Result.id()))
.build());
}
}
resources:
port1:
type: opentelekomcloud:NetworkingPortSecgroupAssociateV2
properties:
portId: ${systemPort.id}
securityGroupIds:
- ${secgroup.id}
variables:
systemPort:
fn::invoke:
function: opentelekomcloud:getNetworkingPortV2
arguments:
fixedIp: 10.0.0.10
secgroup:
fn::invoke:
function: opentelekomcloud:getNetworkingSecgroupV2
arguments:
name: secgroup
Create NetworkingPortSecgroupAssociateV2 Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkingPortSecgroupAssociateV2(name: string, args: NetworkingPortSecgroupAssociateV2Args, opts?: CustomResourceOptions);
@overload
def NetworkingPortSecgroupAssociateV2(resource_name: str,
args: NetworkingPortSecgroupAssociateV2Args,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkingPortSecgroupAssociateV2(resource_name: str,
opts: Optional[ResourceOptions] = None,
port_id: Optional[str] = None,
security_group_ids: Optional[Sequence[str]] = None,
force: Optional[bool] = None,
networking_port_secgroup_associate_v2_id: Optional[str] = None,
region: Optional[str] = None)
func NewNetworkingPortSecgroupAssociateV2(ctx *Context, name string, args NetworkingPortSecgroupAssociateV2Args, opts ...ResourceOption) (*NetworkingPortSecgroupAssociateV2, error)
public NetworkingPortSecgroupAssociateV2(string name, NetworkingPortSecgroupAssociateV2Args args, CustomResourceOptions? opts = null)
public NetworkingPortSecgroupAssociateV2(String name, NetworkingPortSecgroupAssociateV2Args args)
public NetworkingPortSecgroupAssociateV2(String name, NetworkingPortSecgroupAssociateV2Args args, CustomResourceOptions options)
type: opentelekomcloud:NetworkingPortSecgroupAssociateV2
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args NetworkingPortSecgroupAssociateV2Args
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NetworkingPortSecgroupAssociateV2Args
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NetworkingPortSecgroupAssociateV2Args
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkingPortSecgroupAssociateV2Args
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkingPortSecgroupAssociateV2Args
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var networkingPortSecgroupAssociateV2Resource = new Opentelekomcloud.NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource", new()
{
PortId = "string",
SecurityGroupIds = new[]
{
"string",
},
Force = false,
NetworkingPortSecgroupAssociateV2Id = "string",
Region = "string",
});
example, err := opentelekomcloud.NewNetworkingPortSecgroupAssociateV2(ctx, "networkingPortSecgroupAssociateV2Resource", &opentelekomcloud.NetworkingPortSecgroupAssociateV2Args{
PortId: pulumi.String("string"),
SecurityGroupIds: pulumi.StringArray{
pulumi.String("string"),
},
Force: pulumi.Bool(false),
NetworkingPortSecgroupAssociateV2Id: pulumi.String("string"),
Region: pulumi.String("string"),
})
var networkingPortSecgroupAssociateV2Resource = new NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource", NetworkingPortSecgroupAssociateV2Args.builder()
.portId("string")
.securityGroupIds("string")
.force(false)
.networkingPortSecgroupAssociateV2Id("string")
.region("string")
.build());
networking_port_secgroup_associate_v2_resource = opentelekomcloud.NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource",
port_id="string",
security_group_ids=["string"],
force=False,
networking_port_secgroup_associate_v2_id="string",
region="string")
const networkingPortSecgroupAssociateV2Resource = new opentelekomcloud.NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource", {
portId: "string",
securityGroupIds: ["string"],
force: false,
networkingPortSecgroupAssociateV2Id: "string",
region: "string",
});
type: opentelekomcloud:NetworkingPortSecgroupAssociateV2
properties:
force: false
networkingPortSecgroupAssociateV2Id: string
portId: string
region: string
securityGroupIds:
- string
NetworkingPortSecgroupAssociateV2 Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NetworkingPortSecgroupAssociateV2 resource accepts the following input properties:
- Port
Id string - An UUID of the port to apply security groups to.
- Security
Group List<string>Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- Force bool
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - Networking
Port stringSecgroup Associate V2Id - Region string
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource.
- Port
Id string - An UUID of the port to apply security groups to.
- Security
Group []stringIds - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- Force bool
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - Networking
Port stringSecgroup Associate V2Id - Region string
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource.
- port
Id String - An UUID of the port to apply security groups to.
- security
Group List<String>Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- force Boolean
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking
Port StringSecgroup Associate V2Id - region String
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource.
- port
Id string - An UUID of the port to apply security groups to.
- security
Group string[]Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- force boolean
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking
Port stringSecgroup Associate V2Id - region string
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource.
- port_
id str - An UUID of the port to apply security groups to.
- security_
group_ Sequence[str]ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- force bool
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking_
port_ strsecgroup_ associate_ v2_ id - region str
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource.
- port
Id String - An UUID of the port to apply security groups to.
- security
Group List<String>Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- force Boolean
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking
Port StringSecgroup Associate V2Id - region String
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkingPortSecgroupAssociateV2 resource produces the following output properties:
- All
Security List<string>Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- Id string
- The provider-assigned unique ID for this managed resource.
- All
Security []stringGroup Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- Id string
- The provider-assigned unique ID for this managed resource.
- all
Security List<String>Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- id String
- The provider-assigned unique ID for this managed resource.
- all
Security string[]Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- id string
- The provider-assigned unique ID for this managed resource.
- all_
security_ Sequence[str]group_ ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- id str
- The provider-assigned unique ID for this managed resource.
- all
Security List<String>Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing NetworkingPortSecgroupAssociateV2 Resource
Get an existing NetworkingPortSecgroupAssociateV2 resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: NetworkingPortSecgroupAssociateV2State, opts?: CustomResourceOptions): NetworkingPortSecgroupAssociateV2
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
all_security_group_ids: Optional[Sequence[str]] = None,
force: Optional[bool] = None,
networking_port_secgroup_associate_v2_id: Optional[str] = None,
port_id: Optional[str] = None,
region: Optional[str] = None,
security_group_ids: Optional[Sequence[str]] = None) -> NetworkingPortSecgroupAssociateV2
func GetNetworkingPortSecgroupAssociateV2(ctx *Context, name string, id IDInput, state *NetworkingPortSecgroupAssociateV2State, opts ...ResourceOption) (*NetworkingPortSecgroupAssociateV2, error)
public static NetworkingPortSecgroupAssociateV2 Get(string name, Input<string> id, NetworkingPortSecgroupAssociateV2State? state, CustomResourceOptions? opts = null)
public static NetworkingPortSecgroupAssociateV2 get(String name, Output<String> id, NetworkingPortSecgroupAssociateV2State state, CustomResourceOptions options)
resources: _: type: opentelekomcloud:NetworkingPortSecgroupAssociateV2 get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- All
Security List<string>Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- Force bool
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - Networking
Port stringSecgroup Associate V2Id - Port
Id string - An UUID of the port to apply security groups to.
- Region string
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource. - Security
Group List<string>Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- All
Security []stringGroup Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- Force bool
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - Networking
Port stringSecgroup Associate V2Id - Port
Id string - An UUID of the port to apply security groups to.
- Region string
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource. - Security
Group []stringIds - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- all
Security List<String>Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- force Boolean
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking
Port StringSecgroup Associate V2Id - port
Id String - An UUID of the port to apply security groups to.
- region String
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource. - security
Group List<String>Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- all
Security string[]Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- force boolean
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking
Port stringSecgroup Associate V2Id - port
Id string - An UUID of the port to apply security groups to.
- region string
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource. - security
Group string[]Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- all_
security_ Sequence[str]group_ ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- force bool
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking_
port_ strsecgroup_ associate_ v2_ id - port_
id str - An UUID of the port to apply security groups to.
- region str
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource. - security_
group_ Sequence[str]ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
- all
Security List<String>Group Ids - The collection of Security Group IDs on the port which have been explicitly and implicitly added.
- force Boolean
- Whether to replace or append the list of security
groups, specified in the
security_group_ids
. Defaults tofalse
. - networking
Port StringSecgroup Associate V2Id - port
Id String - An UUID of the port to apply security groups to.
- region String
- The region in which to obtain the V2 networking client.
A networking client is needed to manage a port. If omitted, the
region
argument of the provider is used. Changing this creates a new resource. - security
Group List<String>Ids - A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
Import
Port security group association can be imported using the id
of the port, e.g.
$ pulumi import opentelekomcloud:index/networkingPortSecgroupAssociateV2:NetworkingPortSecgroupAssociateV2 port_1 eae26a3e-1c33-4cc1-9c31-5ght78rdf12
lifecycle {
ignore_changes = [
force,
security_group_ids,
]
}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- opentelekomcloud opentelekomcloud/terraform-provider-opentelekomcloud
- License
- Notes
- This Pulumi package is based on the
opentelekomcloud
Terraform Provider.