Skip to content

Commit

Permalink
updated the grp address and added the mtls grp address to the namespa… (
Browse files Browse the repository at this point in the history
#141)

* updated the grp address and added the mtls grp address to the namespace.resource

* generate resolution
  • Loading branch information
jlacefie authored Oct 15, 2024
1 parent e57bce5 commit 92cbaec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion docs/resources/namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ Optional:

Read-Only:

- `grpc_address` (String) The gRPC endpoint for the namespace that clients can connect to.
- `grpc_address` (String) The gRPC address for API key client connections (may be empty if API keys are disabled).
- `mtls_grpc_address` (String) The gRPC address for mTLS client connections (may be empty if mTLS is disabled).
- `web_address` (String) The address in the Temporal Cloud Web UI for the namespace

## Import
Expand Down
21 changes: 14 additions & 7 deletions internal/provider/namespace_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ type (
}

endpointsModel struct {
WebAddress types.String `tfsdk:"web_address"`
GrpcAddress types.String `tfsdk:"grpc_address"`
WebAddress types.String `tfsdk:"web_address"`
GrpcAddress types.String `tfsdk:"grpc_address"`
MtlsGrpcAddress types.String `tfsdk:"mtls_grpc_address"`
}
)

Expand All @@ -109,8 +110,9 @@ var (
}

endpointsAttrs = map[string]attr.Type{
"web_address": types.StringType,
"grpc_address": types.StringType,
"web_address": types.StringType,
"grpc_address": types.StringType,
"mtls_grpc_address": types.StringType,
}
)

Expand Down Expand Up @@ -232,7 +234,11 @@ func (r *namespaceResource) Schema(ctx context.Context, _ resource.SchemaRequest
Description: "The endpoints for the namespace.",
Attributes: map[string]schema.Attribute{
"grpc_address": schema.StringAttribute{
Description: "The gRPC endpoint for the namespace that clients can connect to.",
Description: "The gRPC address for API key client connections (may be empty if API keys are disabled).",
Computed: true,
},
"mtls_grpc_address": schema.StringAttribute{
Description: "The gRPC address for mTLS client connections (may be empty if mTLS is disabled).",
Computed: true,
},
"web_address": schema.StringAttribute{
Expand Down Expand Up @@ -566,8 +572,9 @@ func updateModelFromSpec(ctx context.Context, diags diag.Diagnostics, state *nam
state.CodecServer = codecServerState

endpoints := &endpointsModel{
GrpcAddress: stringOrNull(ns.GetEndpoints().GetGrpcAddress()),
WebAddress: stringOrNull(ns.GetEndpoints().GetWebAddress()),
GrpcAddress: stringOrNull(ns.GetEndpoints().GetGrpcAddress()),
WebAddress: stringOrNull(ns.GetEndpoints().GetWebAddress()),
MtlsGrpcAddress: stringOrNull(ns.GetEndpoints().GetMtlsGrpcAddress()),
}
endpointsState, objectDiags := types.ObjectValueFrom(ctx, endpointsAttrs, endpoints)
diags.Append(objectDiags...)
Expand Down

0 comments on commit 92cbaec

Please sign in to comment.