tencentcloud.RedisSsl
Provides a resource to create a redis ssl
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const zone = tencentcloud.getRedisZoneConfig({
typeId: 7,
region: "ap-guangzhou",
});
const vpc = new tencentcloud.Vpc("vpc", {
cidrBlock: "10.0.0.0/16",
name: "tf_redis_vpc",
});
const subnet = new tencentcloud.Subnet("subnet", {
vpcId: vpc.vpcId,
availabilityZone: zone.then(zone => zone.lists?.[2]?.zone),
name: "tf_redis_subnet",
cidrBlock: "10.0.1.0/24",
});
const securityGroup = new tencentcloud.SecurityGroup("security_group", {name: "tf-redis-sg"});
const example = new tencentcloud.SecurityGroupLiteRule("example", {
securityGroupId: securityGroup.securityGroupId,
ingresses: [
"ACCEPT#192.168.1.0/24#80#TCP",
"DROP#8.8.8.8#80,90#UDP",
"DROP#0.0.0.0/0#80-90#TCP",
],
egresses: [
"ACCEPT#192.168.0.0/16#ALL#TCP",
"ACCEPT#10.0.0.0/8#ALL#ICMP",
"DROP#0.0.0.0/0#ALL#ALL",
],
});
const exampleRedisInstance = new tencentcloud.RedisInstance("example", {
availabilityZone: zone.then(zone => zone.lists?.[2]?.zone),
typeId: zone.then(zone => zone.lists?.[2]?.typeId),
password: "Password@123",
memSize: 8192,
redisShardNum: zone.then(zone => zone.lists?.[2]?.redisShardNums?.[0]),
redisReplicasNum: zone.then(zone => zone.lists?.[2]?.redisReplicasNums?.[0]),
name: "tf_example",
port: 6379,
vpcId: vpc.vpcId,
subnetId: subnet.subnetId,
securityGroups: [securityGroup.securityGroupId],
});
const exampleRedisSsl = new tencentcloud.RedisSsl("example", {
instanceId: exampleRedisInstance.redisInstanceId,
sslConfig: "disabled",
});
import pulumi
import pulumi_tencentcloud as tencentcloud
zone = tencentcloud.get_redis_zone_config(type_id=7,
region="ap-guangzhou")
vpc = tencentcloud.Vpc("vpc",
cidr_block="10.0.0.0/16",
name="tf_redis_vpc")
subnet = tencentcloud.Subnet("subnet",
vpc_id=vpc.vpc_id,
availability_zone=zone.lists[2].zone,
name="tf_redis_subnet",
cidr_block="10.0.1.0/24")
security_group = tencentcloud.SecurityGroup("security_group", name="tf-redis-sg")
example = tencentcloud.SecurityGroupLiteRule("example",
security_group_id=security_group.security_group_id,
ingresses=[
"ACCEPT#192.168.1.0/24#80#TCP",
"DROP#8.8.8.8#80,90#UDP",
"DROP#0.0.0.0/0#80-90#TCP",
],
egresses=[
"ACCEPT#192.168.0.0/16#ALL#TCP",
"ACCEPT#10.0.0.0/8#ALL#ICMP",
"DROP#0.0.0.0/0#ALL#ALL",
])
example_redis_instance = tencentcloud.RedisInstance("example",
availability_zone=zone.lists[2].zone,
type_id=zone.lists[2].type_id,
password="Password@123",
mem_size=8192,
redis_shard_num=zone.lists[2].redis_shard_nums[0],
redis_replicas_num=zone.lists[2].redis_replicas_nums[0],
name="tf_example",
port=6379,
vpc_id=vpc.vpc_id,
subnet_id=subnet.subnet_id,
security_groups=[security_group.security_group_id])
example_redis_ssl = tencentcloud.RedisSsl("example",
instance_id=example_redis_instance.redis_instance_id,
ssl_config="disabled")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
zone, err := tencentcloud.GetRedisZoneConfig(ctx, &tencentcloud.GetRedisZoneConfigArgs{
TypeId: pulumi.Float64Ref(7),
Region: pulumi.StringRef("ap-guangzhou"),
}, nil)
if err != nil {
return err
}
vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
Name: pulumi.String("tf_redis_vpc"),
})
if err != nil {
return err
}
subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
VpcId: vpc.VpcId,
AvailabilityZone: pulumi.String(zone.Lists[2].Zone),
Name: pulumi.String("tf_redis_subnet"),
CidrBlock: pulumi.String("10.0.1.0/24"),
})
if err != nil {
return err
}
securityGroup, err := tencentcloud.NewSecurityGroup(ctx, "security_group", &tencentcloud.SecurityGroupArgs{
Name: pulumi.String("tf-redis-sg"),
})
if err != nil {
return err
}
_, err = tencentcloud.NewSecurityGroupLiteRule(ctx, "example", &tencentcloud.SecurityGroupLiteRuleArgs{
SecurityGroupId: securityGroup.SecurityGroupId,
Ingresses: pulumi.StringArray{
pulumi.String("ACCEPT#192.168.1.0/24#80#TCP"),
pulumi.String("DROP#8.8.8.8#80,90#UDP"),
pulumi.String("DROP#0.0.0.0/0#80-90#TCP"),
},
Egresses: pulumi.StringArray{
pulumi.String("ACCEPT#192.168.0.0/16#ALL#TCP"),
pulumi.String("ACCEPT#10.0.0.0/8#ALL#ICMP"),
pulumi.String("DROP#0.0.0.0/0#ALL#ALL"),
},
})
if err != nil {
return err
}
exampleRedisInstance, err := tencentcloud.NewRedisInstance(ctx, "example", &tencentcloud.RedisInstanceArgs{
AvailabilityZone: pulumi.String(zone.Lists[2].Zone),
TypeId: pulumi.Float64(zone.Lists[2].TypeId),
Password: pulumi.String("Password@123"),
MemSize: pulumi.Float64(8192),
RedisShardNum: pulumi.Float64(zone.Lists[2].RedisShardNums[0]),
RedisReplicasNum: pulumi.Float64(zone.Lists[2].RedisReplicasNums[0]),
Name: pulumi.String("tf_example"),
Port: pulumi.Float64(6379),
VpcId: vpc.VpcId,
SubnetId: subnet.SubnetId,
SecurityGroups: pulumi.StringArray{
securityGroup.SecurityGroupId,
},
})
if err != nil {
return err
}
_, err = tencentcloud.NewRedisSsl(ctx, "example", &tencentcloud.RedisSslArgs{
InstanceId: exampleRedisInstance.RedisInstanceId,
SslConfig: pulumi.String("disabled"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;
return await Deployment.RunAsync(() =>
{
var zone = Tencentcloud.GetRedisZoneConfig.Invoke(new()
{
TypeId = 7,
Region = "ap-guangzhou",
});
var vpc = new Tencentcloud.Vpc("vpc", new()
{
CidrBlock = "10.0.0.0/16",
Name = "tf_redis_vpc",
});
var subnet = new Tencentcloud.Subnet("subnet", new()
{
VpcId = vpc.VpcId,
AvailabilityZone = zone.Apply(getRedisZoneConfigResult => getRedisZoneConfigResult.Lists[2]?.Zone),
Name = "tf_redis_subnet",
CidrBlock = "10.0.1.0/24",
});
var securityGroup = new Tencentcloud.SecurityGroup("security_group", new()
{
Name = "tf-redis-sg",
});
var example = new Tencentcloud.SecurityGroupLiteRule("example", new()
{
SecurityGroupId = securityGroup.SecurityGroupId,
Ingresses = new[]
{
"ACCEPT#192.168.1.0/24#80#TCP",
"DROP#8.8.8.8#80,90#UDP",
"DROP#0.0.0.0/0#80-90#TCP",
},
Egresses = new[]
{
"ACCEPT#192.168.0.0/16#ALL#TCP",
"ACCEPT#10.0.0.0/8#ALL#ICMP",
"DROP#0.0.0.0/0#ALL#ALL",
},
});
var exampleRedisInstance = new Tencentcloud.RedisInstance("example", new()
{
AvailabilityZone = zone.Apply(getRedisZoneConfigResult => getRedisZoneConfigResult.Lists[2]?.Zone),
TypeId = zone.Apply(getRedisZoneConfigResult => getRedisZoneConfigResult.Lists[2]?.TypeId),
Password = "Password@123",
MemSize = 8192,
RedisShardNum = zone.Apply(getRedisZoneConfigResult => getRedisZoneConfigResult.Lists[2]?.RedisShardNums[0]),
RedisReplicasNum = zone.Apply(getRedisZoneConfigResult => getRedisZoneConfigResult.Lists[2]?.RedisReplicasNums[0]),
Name = "tf_example",
Port = 6379,
VpcId = vpc.VpcId,
SubnetId = subnet.SubnetId,
SecurityGroups = new[]
{
securityGroup.SecurityGroupId,
},
});
var exampleRedisSsl = new Tencentcloud.RedisSsl("example", new()
{
InstanceId = exampleRedisInstance.RedisInstanceId,
SslConfig = "disabled",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.TencentcloudFunctions;
import com.pulumi.tencentcloud.inputs.GetRedisZoneConfigArgs;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.SecurityGroup;
import com.pulumi.tencentcloud.SecurityGroupArgs;
import com.pulumi.tencentcloud.SecurityGroupLiteRule;
import com.pulumi.tencentcloud.SecurityGroupLiteRuleArgs;
import com.pulumi.tencentcloud.RedisInstance;
import com.pulumi.tencentcloud.RedisInstanceArgs;
import com.pulumi.tencentcloud.RedisSsl;
import com.pulumi.tencentcloud.RedisSslArgs;
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 zone = TencentcloudFunctions.getRedisZoneConfig(GetRedisZoneConfigArgs.builder()
.typeId(7)
.region("ap-guangzhou")
.build());
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.name("tf_redis_vpc")
.build());
var subnet = new Subnet("subnet", SubnetArgs.builder()
.vpcId(vpc.vpcId())
.availabilityZone(zone.lists()[2].zone())
.name("tf_redis_subnet")
.cidrBlock("10.0.1.0/24")
.build());
var securityGroup = new SecurityGroup("securityGroup", SecurityGroupArgs.builder()
.name("tf-redis-sg")
.build());
var example = new SecurityGroupLiteRule("example", SecurityGroupLiteRuleArgs.builder()
.securityGroupId(securityGroup.securityGroupId())
.ingresses(
"ACCEPT#192.168.1.0/24#80#TCP",
"DROP#8.8.8.8#80,90#UDP",
"DROP#0.0.0.0/0#80-90#TCP")
.egresses(
"ACCEPT#192.168.0.0/16#ALL#TCP",
"ACCEPT#10.0.0.0/8#ALL#ICMP",
"DROP#0.0.0.0/0#ALL#ALL")
.build());
var exampleRedisInstance = new RedisInstance("exampleRedisInstance", RedisInstanceArgs.builder()
.availabilityZone(zone.lists()[2].zone())
.typeId(zone.lists()[2].typeId())
.password("Password@123")
.memSize(8192.0)
.redisShardNum(zone.lists()[2].redisShardNums()[0])
.redisReplicasNum(zone.lists()[2].redisReplicasNums()[0])
.name("tf_example")
.port(6379.0)
.vpcId(vpc.vpcId())
.subnetId(subnet.subnetId())
.securityGroups(securityGroup.securityGroupId())
.build());
var exampleRedisSsl = new RedisSsl("exampleRedisSsl", RedisSslArgs.builder()
.instanceId(exampleRedisInstance.redisInstanceId())
.sslConfig("disabled")
.build());
}
}
resources:
vpc:
type: tencentcloud:Vpc
properties:
cidrBlock: 10.0.0.0/16
name: tf_redis_vpc
subnet:
type: tencentcloud:Subnet
properties:
vpcId: ${vpc.vpcId}
availabilityZone: ${zone.lists[2].zone}
name: tf_redis_subnet
cidrBlock: 10.0.1.0/24
securityGroup:
type: tencentcloud:SecurityGroup
name: security_group
properties:
name: tf-redis-sg
example:
type: tencentcloud:SecurityGroupLiteRule
properties:
securityGroupId: ${securityGroup.securityGroupId}
ingresses:
- ACCEPT#192.168.1.0/24#80#TCP
- DROP#8.8.8.8#80,90#UDP
- DROP#0.0.0.0/0#80-90#TCP
egresses:
- ACCEPT#192.168.0.0/16#ALL#TCP
- ACCEPT#10.0.0.0/8#ALL#ICMP
- DROP#0.0.0.0/0#ALL#ALL
exampleRedisInstance:
type: tencentcloud:RedisInstance
name: example
properties:
availabilityZone: ${zone.lists[2].zone}
typeId: ${zone.lists[2].typeId}
password: Password@123
memSize: 8192
redisShardNum: ${zone.lists[2].redisShardNums[0]}
redisReplicasNum: ${zone.lists[2].redisReplicasNums[0]}
name: tf_example
port: 6379
vpcId: ${vpc.vpcId}
subnetId: ${subnet.subnetId}
securityGroups:
- ${securityGroup.securityGroupId}
exampleRedisSsl:
type: tencentcloud:RedisSsl
name: example
properties:
instanceId: ${exampleRedisInstance.redisInstanceId}
sslConfig: disabled
variables:
zone:
fn::invoke:
function: tencentcloud:getRedisZoneConfig
arguments:
typeId: 7
region: ap-guangzhou
Create RedisSsl Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RedisSsl(name: string, args: RedisSslArgs, opts?: CustomResourceOptions);@overload
def RedisSsl(resource_name: str,
args: RedisSslArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RedisSsl(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
ssl_config: Optional[str] = None,
redis_ssl_id: Optional[str] = None)func NewRedisSsl(ctx *Context, name string, args RedisSslArgs, opts ...ResourceOption) (*RedisSsl, error)public RedisSsl(string name, RedisSslArgs args, CustomResourceOptions? opts = null)
public RedisSsl(String name, RedisSslArgs args)
public RedisSsl(String name, RedisSslArgs args, CustomResourceOptions options)
type: tencentcloud:RedisSsl
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 RedisSslArgs
- 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 RedisSslArgs
- 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 RedisSslArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RedisSslArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RedisSslArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
RedisSsl 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 RedisSsl resource accepts the following input properties:
- Instance
Id string - The ID of instance.
- Ssl
Config string - The SSL configuration status of the instance:
enabled,disabled. - Redis
Ssl stringId - ID of the resource.
- Instance
Id string - The ID of instance.
- Ssl
Config string - The SSL configuration status of the instance:
enabled,disabled. - Redis
Ssl stringId - ID of the resource.
- instance
Id String - The ID of instance.
- ssl
Config String - The SSL configuration status of the instance:
enabled,disabled. - redis
Ssl StringId - ID of the resource.
- instance
Id string - The ID of instance.
- ssl
Config string - The SSL configuration status of the instance:
enabled,disabled. - redis
Ssl stringId - ID of the resource.
- instance_
id str - The ID of instance.
- ssl_
config str - The SSL configuration status of the instance:
enabled,disabled. - redis_
ssl_ strid - ID of the resource.
- instance
Id String - The ID of instance.
- ssl
Config String - The SSL configuration status of the instance:
enabled,disabled. - redis
Ssl StringId - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the RedisSsl resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing RedisSsl Resource
Get an existing RedisSsl 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?: RedisSslState, opts?: CustomResourceOptions): RedisSsl@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
redis_ssl_id: Optional[str] = None,
ssl_config: Optional[str] = None) -> RedisSslfunc GetRedisSsl(ctx *Context, name string, id IDInput, state *RedisSslState, opts ...ResourceOption) (*RedisSsl, error)public static RedisSsl Get(string name, Input<string> id, RedisSslState? state, CustomResourceOptions? opts = null)public static RedisSsl get(String name, Output<String> id, RedisSslState state, CustomResourceOptions options)resources: _: type: tencentcloud:RedisSsl 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.
- Instance
Id string - The ID of instance.
- Redis
Ssl stringId - ID of the resource.
- Ssl
Config string - The SSL configuration status of the instance:
enabled,disabled.
- Instance
Id string - The ID of instance.
- Redis
Ssl stringId - ID of the resource.
- Ssl
Config string - The SSL configuration status of the instance:
enabled,disabled.
- instance
Id String - The ID of instance.
- redis
Ssl StringId - ID of the resource.
- ssl
Config String - The SSL configuration status of the instance:
enabled,disabled.
- instance
Id string - The ID of instance.
- redis
Ssl stringId - ID of the resource.
- ssl
Config string - The SSL configuration status of the instance:
enabled,disabled.
- instance_
id str - The ID of instance.
- redis_
ssl_ strid - ID of the resource.
- ssl_
config str - The SSL configuration status of the instance:
enabled,disabled.
- instance
Id String - The ID of instance.
- redis
Ssl StringId - ID of the resource.
- ssl
Config String - The SSL configuration status of the instance:
enabled,disabled.
Import
redis ssl can be imported using the instanceId, e.g.
$ pulumi import tencentcloud:index/redisSsl:RedisSsl example crs-c1nl9rpv
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloudTerraform Provider.
