# README
ghbranchdefault
Package ghbranchdefault provides methods to create github_branch_default
terraform resource
Functions
func New
func New(c ConfigProvider) *hclwrite.Block
New returns the github_branch_default
terraform resource as hclwrite.Block
It returns nil
if resource is empty.
valGen := gh2tf.NewValueGenerator()
repoName := "repository_name"
branchName := "my_default_branch_name"
res := &ghbranchdefault.Config{
valGen,
"res-id",
&repoName,
&branchName,
}
repoNameAsLink := "github_repository.res-id.name"
branchNameAsLink := "github_branch.res-id.branch"
resWithLinks := &ghbranchdefault.Config{
valGen,
"res-id-with-links",
&repoNameAsLink,
&branchNameAsLink,
}
hclFile := hclwrite.NewEmptyFile()
hclFile.Body().AppendBlock(ghbranchdefault.New(res))
hclFile.Body().AppendBlock(ghbranchdefault.New(resWithLinks))
fmt.Println(string(hclFile.Bytes()))
Output:
resource "github_branch_default" "res-id" {
repository = "repository_name"
branch = "my_default_branch_name"
}
resource "github_branch_default" "res-id-with-links" {
repository = github_repository.res-id.name
branch = github_branch.res-id.branch
}
func NewSignature
func NewSignature(conf ConfigProvider) *tfsig.BlockSignature
NewSignature returns the github_branch_default
terraform resource as tfsig.BlockSignature
It returns nil
if resource is empty.
Types
type Config
type Config struct { ... }
Config is the default implementation of ConfigProvider
.
func (*Config) BranchValue
func (c *Config) BranchValue() *cty.Value
BranchValue return the provided github_branch_default
branch
attribute value as cty.String
or nil
if not provided.
func (*Config) HasResource
func (c *Config) HasResource() bool
HasResource returns true
in case both BranchConfig
and Repository
value exist, else false
.
func (*Config) RepositoryValue
func (c *Config) RepositoryValue() *cty.Value
RepositoryValue return the provided github_branch_default
repository
attribute value as cty.String
or nil
if not provided.
func (*Config) ResourceIdentifier
func (c *Config) ResourceIdentifier() string
ResourceIdentifier returns the provided terraform resource identifier.
type ConfigProvider
type ConfigProvider interface { ... }
ConfigProvider defines required methods to be used when creating github_branch_default
terraform resource.
Readme created from Go doc with goreadme