diff --git a/agent/consul/connect_ca_provider.go b/agent/consul/connect_ca_provider.go index d7d76f88e..1dbe884c7 100644 --- a/agent/consul/connect_ca_provider.go +++ b/agent/consul/connect_ca_provider.go @@ -19,14 +19,8 @@ import ( "github.com/mitchellh/mapstructure" ) -type ConsulCAProviderConfig struct { - PrivateKey string - RootCert string - RotationPeriod time.Duration -} - type ConsulCAProvider struct { - config *ConsulCAProviderConfig + config *structs.ConsulCAProviderConfig id string srv *Server @@ -122,8 +116,8 @@ func NewConsulCAProvider(rawConfig map[string]interface{}, srv *Server) (*Consul return provider, nil } -func decodeConfig(raw map[string]interface{}) (*ConsulCAProviderConfig, error) { - var config *ConsulCAProviderConfig +func decodeConfig(raw map[string]interface{}) (*structs.ConsulCAProviderConfig, error) { + var config *structs.ConsulCAProviderConfig if err := mapstructure.WeakDecode(raw, &config); err != nil { return nil, fmt.Errorf("error decoding config: %s", err) } diff --git a/agent/consul/connect_ca_provider_test.go b/agent/consul/connect_ca_provider_test.go index adad3acba..583f91722 100644 --- a/agent/consul/connect_ca_provider_test.go +++ b/agent/consul/connect_ca_provider_test.go @@ -28,7 +28,5 @@ func TestCAProvider_Bootstrap(t *testing.T) { state := s1.fsm.State() _, activeRoot, err := state.CARootActive(nil) assert.NoError(err) - assert.Equal(root.ID, activeRoot.ID) - assert.Equal(root.Name, activeRoot.Name) - assert.Equal(root.RootCert, activeRoot.RootCert) + assert.Equal(root, activeRoot.RootCert) } diff --git a/agent/structs/connect_ca.go b/agent/structs/connect_ca.go index 4562fc1ea..c46db703a 100644 --- a/agent/structs/connect_ca.go +++ b/agent/structs/connect_ca.go @@ -160,6 +160,12 @@ type CAConfiguration struct { RaftIndex } +type ConsulCAProviderConfig struct { + PrivateKey string + RootCert string + RotationPeriod time.Duration +} + // CAConsulProviderState is used to track the built-in Consul CA provider's state. type CAConsulProviderState struct { ID string