Documentation

Index

Constants

View Source
const ARTIF_TFSTATE_NAME = "terraform.tfstate"

Variables

View Source
var BuiltinClients = map[string]Factory{
	"artifactory": artifactoryFactory,
	"etcd":        etcdFactory,
	"http":        httpFactory,
	"local":       fileFactory,
}

    BuiltinClients is the list of built-in clients that can be used with NewClient.

    Functions

    func TestClient

    func TestClient(t *testing.T, c Client)

      TestClient is a generic function to test any client.

      func TestRemoteLocks

      func TestRemoteLocks(t *testing.T, a, b Client)

        Test the lock implementation for a remote.Client. This test requires 2 client instances, in oder to have multiple remote clients since some implementations may tie the client to the lock, or may have reentrant locks.

        Types

        type ArtifactoryClient

        type ArtifactoryClient struct {
        	// contains filtered or unexported fields
        }

        func (*ArtifactoryClient) Delete

        func (c *ArtifactoryClient) Delete() error

        func (*ArtifactoryClient) Get

        func (c *ArtifactoryClient) Get() (*Payload, error)

        func (*ArtifactoryClient) Put

        func (c *ArtifactoryClient) Put(data []byte) error

        type Client

        type Client interface {
        	Get() (*Payload, error)
        	Put([]byte) error
        	Delete() error
        }

          Client is the interface that must be implemented for a remote state driver. It supports dumb put/get/delete, and the higher level structs handle persisting the state properly here.

          func NewClient

          func NewClient(t string, conf map[string]string) (Client, error)

            NewClient returns a new Client with the given type and configuration. The client is looked up in the BuiltinClients variable.

            type ClientLocker

            type ClientLocker interface {
            	Client
            	state.Locker
            }

              ClientLocker is an optional interface that allows a remote state backend to enable state lock/unlock.

              type EtcdClient

              type EtcdClient struct {
              	Client etcdapi.Client
              	Path   string
              }

                EtcdClient is a remote client that stores data in etcd.

                func (*EtcdClient) Delete

                func (c *EtcdClient) Delete() error

                func (*EtcdClient) Get

                func (c *EtcdClient) Get() (*Payload, error)

                func (*EtcdClient) Put

                func (c *EtcdClient) Put(data []byte) error

                type Factory

                type Factory func(map[string]string) (Client, error)

                  Factory is the factory function to create a remote client.

                  type FileClient

                  type FileClient struct {
                  	Path string
                  }

                    FileClient is a remote client that stores data locally on disk. This is only used for development reasons to test remote state... locally.

                    func (*FileClient) Delete

                    func (c *FileClient) Delete() error

                    func (*FileClient) Get

                    func (c *FileClient) Get() (*Payload, error)

                    func (*FileClient) Put

                    func (c *FileClient) Put(data []byte) error

                    type GCSClient

                    type GCSClient struct {
                    	// contains filtered or unexported fields
                    }

                    func (*GCSClient) Delete

                    func (c *GCSClient) Delete() error

                    func (*GCSClient) Get

                    func (c *GCSClient) Get() (*Payload, error)

                    func (*GCSClient) Put

                    func (c *GCSClient) Put(data []byte) error

                    type HTTPClient

                    type HTTPClient struct {
                    	// Update & Retrieve
                    	URL          *url.URL
                    	UpdateMethod string
                    
                    	// Locking
                    	LockURL      *url.URL
                    	LockMethod   string
                    	UnlockURL    *url.URL
                    	UnlockMethod string
                    
                    	// HTTP
                    	Client   *http.Client
                    	Username string
                    	Password string
                    	// contains filtered or unexported fields
                    }

                      HTTPClient is a remote client that stores data in Consul or HTTP REST.

                      func (*HTTPClient) Delete

                      func (c *HTTPClient) Delete() error

                      func (*HTTPClient) Get

                      func (c *HTTPClient) Get() (*Payload, error)

                      func (*HTTPClient) Lock

                      func (c *HTTPClient) Lock(info *state.LockInfo) (string, error)

                      func (*HTTPClient) Put

                      func (c *HTTPClient) Put(data []byte) error

                      func (*HTTPClient) Unlock

                      func (c *HTTPClient) Unlock(id string) error

                      type Payload

                      type Payload struct {
                      	MD5  []byte
                      	Data []byte
                      }

                        Payload is the return value from the remote state storage.

                        type State

                        type State struct {
                        	Client Client
                        	// contains filtered or unexported fields
                        }

                          State implements the State interfaces in the state package to handle reading and writing the remote state. This State on its own does no local caching so every persist will go to the remote storage and local writes will go to memory.

                          func (*State) Lock

                          func (s *State) Lock(info *state.LockInfo) (string, error)

                            Lock calls the Client's Lock method if it's implemented.

                            func (*State) PersistState

                            func (s *State) PersistState() error

                              StatePersister impl.

                              func (*State) RefreshState

                              func (s *State) RefreshState() error

                                StateRefresher impl.

                                func (*State) State

                                func (s *State) State() *terraform.State

                                  StateReader impl.

                                  func (*State) Unlock

                                  func (s *State) Unlock(id string) error

                                    Unlock calls the Client's Unlock method if it's implemented.

                                    func (*State) WriteState

                                    func (s *State) WriteState(state *terraform.State) error

                                      StateWriter impl.