Skip to content

Commit faeb2a4

Browse files
committed
fix more things
1 parent 067d2c2 commit faeb2a4

File tree

3 files changed

+24
-36
lines changed

3 files changed

+24
-36
lines changed

examples/network/main.tf

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,15 @@
11
terraform {
22
required_providers {
3-
aws = {
4-
source = "hashicorp/aws"
5-
version = "5.50.0"
6-
}
7-
83
dfcloud = {
94
source = "registry.terraform.io/dragonflydb/dfcloud"
105
}
116
}
127
}
138

14-
provider "aws" {
15-
# Configuration options
16-
}
17-
189
provider "dfcloud" {
1910
# Configuration options
2011
}
2112

22-
data "aws_caller_identity" "current" {}
23-
24-
# client VPC
25-
resource "aws_vpc" "client" {
26-
cidr_block = "10.0.0.0/16"
27-
28-
tags = {
29-
Name = "client"
30-
}
31-
}
3213

3314
# private network
3415
resource "dfcloud_network" "network" {
@@ -40,23 +21,20 @@ resource "dfcloud_network" "network" {
4021
cidr_block = "192.168.0.0/16"
4122
}
4223

43-
# private connection
44-
resource "dfcloud_connection" "connection" {
45-
depends_on = [aws_vpc.client, dfcloud_network.network]
24+
resource "dfcloud_datastore" "datastore" {
25+
name = "tf-test-no-pass"
4626

47-
name = "connection"
48-
peer = {
49-
account_id = data.aws_caller_identity.current.account_id
50-
region = "us-east-1"
51-
vpc_id = aws_vpc.client.id
27+
tier = {
28+
max_memory_bytes = 3000000000
29+
performance_tier = "dev"
30+
replicas = 1
5231
}
5332

54-
network_id = dfcloud_network.network.id
55-
}
56-
57-
resource "aws_vpc_peering_connection_accepter" "accepter" {
58-
depends_on = [dfcloud_connection.connection]
33+
location = {
34+
region = "us-east-1"
35+
provider = "aws"
36+
}
5937

60-
vpc_peering_connection_id = dfcloud_connection.connection.peer_connection_id
61-
auto_accept = true
38+
disable_pass_key = true
39+
network_id = dfcloud_network.network.id
6240
}

internal/provider/datastore.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ func (r *datastoreResource) Schema(_ context.Context, _ resource.SchemaRequest,
4141
MarkdownDescription: "The timestamp when the datastore was created.",
4242
Computed: true,
4343
},
44+
"disable_pass_key": schema.BoolAttribute{
45+
MarkdownDescription: "Disable the passkey for the datastore.",
46+
Optional: true,
47+
},
48+
// password cant be set by a user
4449
"password": schema.StringAttribute{
4550
MarkdownDescription: "The password for the datastore.",
51+
Optional: false,
52+
Required: false,
4653
Computed: true,
4754
Sensitive: true,
4855
},

internal/resource_model/datastore.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Datastore struct {
2121
CreatedAt types.Int64 `tfsdk:"created_at"`
2222
Password types.String `tfsdk:"password"`
2323
Addr types.String `tfsdk:"addr"`
24-
DisablePassKey types.Bool `tfsdk:"disable_passkey"`
24+
DisablePassKey types.Bool `tfsdk:"disable_pass_key"`
2525
}
2626

2727
type DatastoreLocation struct {
@@ -49,7 +49,10 @@ func (d *Datastore) FromConfig(in *dfcloud.Datastore) {
4949
d.Tier.Memory = types.Int64Value(int64(in.Config.Tier.Memory))
5050
d.Tier.PerformanceTier = types.StringValue(string(in.Config.Tier.PerformanceTier))
5151
d.Tier.Replicas = types.Int64Value(int64(*in.Config.Tier.Replicas))
52-
d.DisablePassKey = types.BoolPointerValue(in.Config.DisablePasskey)
52+
53+
if in.Key == "" {
54+
d.DisablePassKey = types.BoolValue(true)
55+
}
5356

5457
aclRules, _ := types.ListValueFrom(context.Background(), types.StringType, in.Config.Dragonfly.AclRules)
5558
d.Dragonfly = types.ObjectValueMust(map[string]attr.Type{

0 commit comments

Comments
 (0)