Documentation
¶
Overview ¶
Package team synchronises teams with a Terraform Cloud organisation.
Requirements ¶
In order to synchronise with Terraform cloud, you will need an Organization API token: https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/api-tokens#organization-api-tokens
Examples ¶
See [New] and Init.
Index ¶
Examples ¶
Constants ¶
View Source
const Organisation gosync.ConfigKey = "terraform_cloud_organisation"
Organisation sets the Terraform Cloud organisation.
View Source
const Token gosync.ConfigKey = "terraform_cloud_token"
Token sets the authentication token for Terraform Cloud.
Variables ¶
This section is empty.
Functions ¶
func WithClient ¶ added in v0.14.0
WithClient passes a custom Terraform Cloud client to the adapter.
Example ¶
package main
import (
"context"
"log"
"github.com/hashicorp/go-tfe"
gosync "github.com/ovotech/go-sync"
"github.com/ovotech/go-sync/adapters/terraformcloud/team"
)
func main() {
ctx := context.Background()
client, err := tfe.NewClient(&tfe.Config{Token: "token"})
if err != nil {
log.Fatal(err)
}
adapter, err := team.Init(ctx, map[gosync.ConfigKey]string{
team.Organisation: "ovotech",
}, team.WithClient(client))
if err != nil {
log.Fatal(err)
}
gosync.New(adapter)
}
Output:
func WithLogger ¶ added in v0.14.0
WithLogger passes a custom logger to the adapter.
Example ¶
package main
import (
"context"
"log"
"os"
gosync "github.com/ovotech/go-sync"
"github.com/ovotech/go-sync/adapters/terraformcloud/team"
)
func main() {
ctx := context.Background()
logger := log.New(os.Stdout, "", log.LstdFlags)
adapter, err := team.Init(ctx, map[gosync.ConfigKey]string{
team.Token: "my-org-token",
team.Organisation: "ovotech",
}, team.WithLogger(logger))
if err != nil {
log.Fatal(err)
}
gosync.New(adapter)
}
Output:
Types ¶
type Team ¶
func Init ¶
func Init(_ context.Context, config map[gosync.ConfigKey]string, configFns ...gosync.ConfigFn[*Team]) (*Team, error)
Init a new Terraform Cloud Team gosync.Adapter.
Required config:
Example ¶
package main
import (
"context"
"log"
gosync "github.com/ovotech/go-sync"
"github.com/ovotech/go-sync/adapters/terraformcloud/team"
)
func main() {
ctx := context.Background()
adapter, err := team.Init(ctx, map[gosync.ConfigKey]string{
team.Token: "my-org-token",
team.Organisation: "ovotech",
})
if err != nil {
log.Fatal(err)
}
gosync.New(adapter)
}
Output:
Click to show internal directories.
Click to hide internal directories.