Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_fluid_relay_server - add primary_key and secondary_key properties #18765

Merged
merged 2 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions internal/services/fluidrelay/fluid_relay_servers_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type ServerModel struct {
Location string `tfschema:"location"`
StorageSKU string `tfschema:"storage_sku"`
FrsTenantId string `tfschema:"frs_tenant_id"`
PrimaryKey string `tfschema:"primary_key"`
SecondaryKey string `tfschema:"secondary_key"`
OrdererEndpoints []string `tfschema:"orderer_endpoints"`
StorageEndpoints []string `tfschema:"storage_endpoints"`
ServiceEndpoints []string `tfschema:"service_endpoints"`
Expand Down Expand Up @@ -112,6 +114,16 @@ func (s Server) Attributes() map[string]*pluginsdk.Schema {
Type: pluginsdk.TypeString,
},
},

"primary_key": {
Type: pluginsdk.TypeString,
Computed: true,
},

"secondary_key": {
Type: pluginsdk.TypeString,
Computed: true,
wuxu92 marked this conversation as resolved.
Show resolved Hide resolved
},
}
}

Expand Down Expand Up @@ -256,6 +268,17 @@ func (s Server) Read() sdk.ResourceFunc {
if val, ok := meta.ResourceData.GetOk("storage_sku"); ok {
output.StorageSKU = val.(string)
}

keyRes, err := client.ListKeys(ctx, *id)
if err != nil {
// do not return if only list keys error
meta.Logger.Warnf("retrieving relay server keys err: %v", err)
wuxu92 marked this conversation as resolved.
Show resolved Hide resolved
}
if keys := keyRes.Model; model != nil {
output.PrimaryKey = utils.NormalizeNilableString(keys.Key1)
output.SecondaryKey = utils.NormalizeNilableString(keys.Key2)
}

return meta.Encode(output)
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestAccFluidRelay_basic(t *testing.T) {
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(f),
check.That(data.ResourceName).Key("frs_tenant_id").IsUUID(),
check.That(data.ResourceName).Key("primary_key").Exists(),
check.That(data.ResourceName).Key("orderer_endpoints.0").Exists(),
check.That(data.ResourceName).Key("service_endpoints.#").Exists(),
),
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/fluid_relay_servers.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `frs_tenant_id` - The Fluid tenantId for this server.

* `primary_key` - The primary key for this server.

* `secondary_key` - The secondary key for this server.

* `orderer_endpoints` - An array of the Fluid Relay Orderer endpoints.

* `storage_endpoints` - An array of storage endpoints for this Fluid Relay Server.
Expand Down