Skip to content

Commit

Permalink
Stateless resources require kibana
Browse files Browse the repository at this point in the history
  • Loading branch information
tobio committed Mar 1, 2024
1 parent 0f02f8d commit 1291b94
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ec/ecresource/deploymentresource/apm/v2/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ package v2

import (
"github.com/elastic/terraform-provider-ec/ec/internal/planmodifiers"
"github.com/hashicorp/terraform-plugin-framework-validators/objectvalidator"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
)

func ApmConfigSchema() schema.Attribute {
return schema.SingleNestedAttribute{
Description: `Optionally define the Apm configuration options for the APM Server`,
Optional: true,
Validators: []validator.Object{
objectvalidator.AlsoRequires(path.MatchRoot("kibana")),
},
Attributes: map[string]schema.Attribute{
"docker_image": schema.StringAttribute{
Description: "Optionally override the docker image the APM nodes will use. This option will not work in ESS customers and should only be changed if you know what you're doing.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,23 @@ package v2

import (
"github.com/elastic/terraform-provider-ec/ec/internal/planmodifiers"
"github.com/hashicorp/terraform-plugin-framework-validators/objectvalidator"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
)

func EnterpriseSearchSchema() schema.Attribute {
return schema.SingleNestedAttribute{
Description: "Enterprise Search cluster definition.",
Optional: true,
Validators: []validator.Object{
objectvalidator.AlsoRequires(path.MatchRoot("kibana")),
},
Attributes: map[string]schema.Attribute{
"elasticsearch_cluster_ref_id": schema.StringAttribute{
Optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,25 @@ package v2

import (
"github.com/elastic/terraform-provider-ec/ec/internal/planmodifiers"
"github.com/hashicorp/terraform-plugin-framework-validators/objectvalidator"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
)

func IntegrationsServerSchema() schema.Attribute {
return schema.SingleNestedAttribute{
Description: "Integrations Server cluster definition. Integrations Server replaces `apm` in Stack versions > 8.0",
Optional: true,
Validators: []validator.Object{
objectvalidator.AlsoRequires(path.MatchRoot("kibana")),
},
Attributes: map[string]schema.Attribute{
"elasticsearch_cluster_ref_id": schema.StringAttribute{
Optional: true,
Expand Down

0 comments on commit 1291b94

Please sign in to comment.