Documentation ¶
Overview ¶
Package ghrepository provides methods to create `github_repository` terraform resource
Index ¶
- func New(conf ConfigProvider) *hclwrite.Block
- func NewPagesSignature(conf PagesConfigProvider) *tfsig.BlockSignature
- func NewPagesSourceSignature(conf PagesSourceConfigProvider) *tfsig.BlockSignature
- func NewSignature(conf ConfigProvider) *tfsig.BlockSignature
- func NewTemplateSignature(conf TemplateConfigProvider) *tfsig.BlockSignature
- type Config
- func (c *Config) AllowAutoMergeValue() *cty.Value
- func (c *Config) AllowMergeCommitValue() *cty.Value
- func (c *Config) AllowRebaseMergeValue() *cty.Value
- func (c *Config) AllowSquashMergeValue() *cty.Value
- func (c *Config) ArchiveOnDestroyValue() *cty.Value
- func (c *Config) ArchivedValue() *cty.Value
- func (c *Config) AutoInitValue() *cty.Value
- func (c *Config) DeleteBranchOnMergeValue() *cty.Value
- func (c *Config) DescriptionValue() *cty.Value
- func (c *Config) HasDownloadsValue() *cty.Value
- func (c *Config) HasIssuesValue() *cty.Value
- func (c *Config) HasProjectsValue() *cty.Value
- func (c *Config) HasResource() bool
- func (c *Config) HasWikiValue() *cty.Value
- func (c *Config) HomepageUrlValue() *cty.Value
- func (c *Config) MergeCommitMessageValue() *cty.Value
- func (c *Config) MergeCommitTitleValue() *cty.Value
- func (c *Config) NameValue() *cty.Value
- func (c *Config) PagesConfig() PagesConfigProvider
- func (c *Config) ResourceIdentifier() string
- func (c *Config) SquashMergeCommitMessageValue() *cty.Value
- func (c *Config) SquashMergeCommitTitleValue() *cty.Value
- func (c *Config) TemplateConfig() TemplateConfigProvider
- func (c *Config) TopicsValue() *cty.Value
- func (c *Config) VisibilityValue() *cty.Value
- func (c *Config) VulnerabilityAlertsValue() *cty.Value
- type ConfigProvider
- type PagesConfig
- type PagesConfigProvider
- type PagesSourceConfig
- type PagesSourceConfigProvider
- type TemplateConfig
- type TemplateConfigProvider
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(conf ConfigProvider) *hclwrite.Block
New returns the `github_repository` terraform resource as `hclwrite.Block`
It returns `nil` if resource is empty.
Example ¶
valGen := gh2tf.NewValueGenerator() repoName := "repository_name" visibility := "var.default_visibility" trueBool := "true" falseBool := "false" topics := []string{"topic"} description := "local.my_local" homepageUrl := "homepage-url" mergeCommitTitle := "merge-commit-title" mergeCommitMessage := "merge-commit-message" squashMergeCommitTitle := "squash-merge-commit-title" squashMergeCommitMessage := "squash-merge-commit-message" repoPageSourcePath := "branch" repoPageSourceSource := "source" templateOwner := "owner" templateRepository := "repository" res := &ghrepository.Config{ valGen, "repository-id", &repoName, &visibility, &falseBool, &description, &falseBool, &trueBool, &falseBool, &trueBool, &falseBool, &homepageUrl, &topics, &trueBool, &falseBool, &trueBool, &falseBool, &trueBool, &mergeCommitTitle, &mergeCommitMessage, &squashMergeCommitTitle, &squashMergeCommitMessage, &falseBool, &trueBool, &ghrepository.PagesConfig{ &ghrepository.PagesSourceConfig{valGen, &repoPageSourcePath, &repoPageSourceSource}, }, &ghrepository.TemplateConfig{valGen, &templateOwner, &templateRepository}, } hclFile := hclwrite.NewEmptyFile() hclFile.Body().AppendBlock(ghrepository.New(res)) fmt.Println(string(hclFile.Bytes()))
Output: resource "github_repository" "repository-id" { name = "repository_name" auto_init = false visibility = var.default_visibility description = local.my_local template { owner = "owner" repository = "repository" } topics = ["topic"] homepage_url = "homepage-url" pages { source { branch = "branch" path = "source" } } has_issues = true has_projects = false has_wiki = true has_downloads = false allow_merge_commit = false allow_rebase_merge = true allow_squash_merge = false allow_auto_merge = true delete_branch_on_merge = false merge_commit_title = "merge-commit-title" merge_commit_message = "merge-commit-message" squash_merge_commit_title = "squash-merge-commit-title" squash_merge_commit_message = "squash-merge-commit-message" vulnerability_alerts = true archived = false archive_on_destroy = true }
func NewPagesSignature ¶
func NewPagesSignature(conf PagesConfigProvider) *tfsig.BlockSignature
NewPagesSignature returns the `github_repository->pages` terraform block as `tfsig.BlockSignature`
It returns `nil` if resource is empty.
func NewPagesSourceSignature ¶
func NewPagesSourceSignature(conf PagesSourceConfigProvider) *tfsig.BlockSignature
NewPagesSourceSignature returns the `github_repository->pages->source` terraform block as `tfsig.BlockSignature`
It returns `nil` if resource is empty.
func NewSignature ¶
func NewSignature(conf ConfigProvider) *tfsig.BlockSignature
NewSignature returns the `github_branch_protection` terraform resource as `tfsig.BlockSignature`
It returns `nil` if resource is empty.
func NewTemplateSignature ¶
func NewTemplateSignature(conf TemplateConfigProvider) *tfsig.BlockSignature
NewTemplateSignature returns the `github_repository->template` terraform block as `tfsig.BlockSignature`
It returns `nil` if resource is empty.
Types ¶
type Config ¶
type Config struct { ValueGenerator tfsig.ValueGenerator Identifier string Name *string Visibility *string Archived *string Description *string AutoInit *string HasIssues *string HasProjects *string HasWiki *string HasDownloads *string HomepageUrl *string Topics *[]string VulnerabilityAlerts *string AllowMergeCommit *string AllowRebaseMerge *string AllowSquashMerge *string AllowAutoMerge *string MergeCommitTitle *string MergeCommitMessage *string SquashMergeCommitTitle *string SquashMergeCommitMessage *string DeleteBranchOnMerge *string ArchiveOnDestroy *string Page *PagesConfig Template *TemplateConfig }
Config is the default implementation of `ConfigProvider`.
func (*Config) AllowAutoMergeValue ¶
AllowAutoMergeValue returns the provided `github_repository` `allow_auto_merge` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) AllowMergeCommitValue ¶
AllowMergeCommitValue returns the provided `github_repository` `allow_merge_commit` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) AllowRebaseMergeValue ¶
AllowRebaseMergeValue returns the provided `github_repository` `allow_rebase_merge` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) AllowSquashMergeValue ¶
AllowSquashMergeValue returns the provided `github_repository` `allow_squash_merge` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) ArchiveOnDestroyValue ¶
ArchiveOnDestroyValue returns the provided `github_repository` `archive_on_destroy` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) ArchivedValue ¶
ArchivedValue returns the provided `github_repository` `archived` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) AutoInitValue ¶
AutoInitValue returns the provided `github_repository` `auto_init` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) DeleteBranchOnMergeValue ¶
DeleteBranchOnMergeValue returns the provided `github_repository` `delete_branch_on_merge` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) DescriptionValue ¶
DescriptionValue returns the provided `github_repository` `description` attribute value as `cty.String` or `nil` if not provided.
func (*Config) HasDownloadsValue ¶
HasDownloadsValue returns the provided `github_repository` `has_downloads` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) HasIssuesValue ¶
HasIssuesValue returns the provided `github_repository` `has_issues` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) HasProjectsValue ¶
HasProjectsValue returns the provided `github_repository` `has_projects` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) HasResource ¶
HasResource returns `true` in case at least `Name` value exists, else `false`.
func (*Config) HasWikiValue ¶
HasWikiValue returns the provided `github_repository` `has_wiki` attribute value as `cty.Bool` or `nil` if not provided.
func (*Config) HomepageUrlValue ¶
HomepageUrlValue returns the provided `github_repository` `homepage_url` attribute value as `cty.String` or `nil` if not provided.
func (*Config) MergeCommitMessageValue ¶
MergeCommitMessageValue returns the provided `github_repository` `merge_commit_message` attribute value as `cty.String` or `nil` if not provided.
func (*Config) MergeCommitTitleValue ¶
MergeCommitTitleValue returns the provided `github_repository` `merge_commit_title` attribute value as `cty.String` or `nil` if not provided.
func (*Config) NameValue ¶
NameValue returns the provided `github_repository` `name` attribute value as `cty.String` or `nil` if not provided.
func (*Config) PagesConfig ¶
func (c *Config) PagesConfig() PagesConfigProvider
PagesConfig returns the provided `PagesConfigProvider`.
func (*Config) ResourceIdentifier ¶
ResourceIdentifier returns the provided terraform resource identifier.
func (*Config) SquashMergeCommitMessageValue ¶
SquashMergeCommitMessageValue returns the provided `github_repository` `squash_merge_commit_message` attribute value as `cty.String` or `nil` if not provided.
func (*Config) SquashMergeCommitTitleValue ¶
SquashMergeCommitTitleValue returns the provided `github_repository` `squash_merge_commit_title` attribute value as `cty.String` or `nil` if not provided.
func (*Config) TemplateConfig ¶
func (c *Config) TemplateConfig() TemplateConfigProvider
TemplateConfig returns the provided `TemplateConfigProvider`.
func (*Config) TopicsValue ¶
TopicsValue returns the provided `github_repository` `topics` attribute value as `cty.List` of `cty.String` or `nil` if not provided.
func (*Config) VisibilityValue ¶
VisibilityValue returns the provided `github_repository` `visibility` attribute value as `cty.String` or `nil` if not provided.
func (*Config) VulnerabilityAlertsValue ¶
VulnerabilityAlertsValue returns the provided `github_repository` `vulnerabililty_alerts` attribute value as `cty.Bool` or `nil` if not provided.
type ConfigProvider ¶
type ConfigProvider interface { // HasResource will indicate if resource has to be created (return `true` for instance to always create the // resource even if empty) HasResource() bool // ResourceIdentifier returns the resource identifier ResourceIdentifier() string // NameValue return the `github_repository` `name` attribute value. // // If `nil` is returned, attribute will be omitted NameValue() *cty.Value // VisibilityValue return the `github_repository` `visbility` attribute value. // // If `nil` is returned, attribute will be omitted VisibilityValue() *cty.Value // ArchivedValue return the `github_repository` `archived` attribute value. // // If `nil` is returned, attribute will be omitted ArchivedValue() *cty.Value // DescriptionValue return the `github_repository` `description` attribute value. // // If `nil` is returned, attribute will be omitted DescriptionValue() *cty.Value // AutoInitValue return the `github_repository` `auto_init` attribute value. // // If `nil` is returned, attribute will be omitted AutoInitValue() *cty.Value // HasIssuesValue return the `github_repository` `has_issues` attribute value. // // If `nil` is returned, attribute will be omitted HasIssuesValue() *cty.Value // HasProjectsValue return the `github_repository` `has_projects` attribute value. // // If `nil` is returned, attribute will be omitted HasProjectsValue() *cty.Value // HasWikiValue return the `github_repository` `has_wiki` attribute value. // // If `nil` is returned, attribute will be omitted HasWikiValue() *cty.Value // HasDownloadsValue return the `github_repository` `has_downloads` attribute value. // // If `nil` is returned, attribute will be omitted HasDownloadsValue() *cty.Value // HomepageUrlValue return the `github_repository` `homepage_url` attribute value. // // If `nil` is returned, attribute will be omitted HomepageUrlValue() *cty.Value // TopicsValue return the `github_repository` `topics` attribute value. // // If `nil` is returned, attribute will be omitted TopicsValue() *cty.Value // VulnerabilityAlertsValue return the `github_repository` `vulnerability` attribute value. // // If `nil` is returned, attribute will be omitted VulnerabilityAlertsValue() *cty.Value // AllowMergeCommitValue return the `github_repository` `allow_merge_commit` attribute value. // // If `nil` is returned, attribute will be omitted AllowMergeCommitValue() *cty.Value // AllowRebaseMergeValue return the `github_repository` `allow_rebase_merge` attribute value. // // If `nil` is returned, attribute will be omitted AllowRebaseMergeValue() *cty.Value // AllowSquashMergeValue return the `github_repository` `allow_squash_merge` attribute value. // // If `nil` is returned, attribute will be omitted AllowSquashMergeValue() *cty.Value // AllowAutoMergeValue return the `github_repository` `allow_auto_merge` attribute value. // // If `nil` is returned, attribute will be omitted AllowAutoMergeValue() *cty.Value // MergeCommitTitleValue return the `github_repository` `merge_commit_title` attribute value. // // If `nil` is returned, attribute will be omitted MergeCommitTitleValue() *cty.Value // MergeCommitMessageValue return the `github_repository` `merge_commit_message` attribute value. // // If `nil` is returned, attribute will be omitted MergeCommitMessageValue() *cty.Value // SquashMergeCommitTitleValue return the `github_repository` `squash_merge_commit_title` attribute value. // // If `nil` is returned, attribute will be omitted SquashMergeCommitTitleValue() *cty.Value // SquashMergeCommitMessageValue return the `github_repository` `squash_merge_commit_message` attribute value. // // If `nil` is returned, attribute will be omitted SquashMergeCommitMessageValue() *cty.Value // DeleteBranchOnMergeValue return the `github_repository` `delete_branch_on_merge` attribute value. // // If `nil` is returned, attribute will be omitted DeleteBranchOnMergeValue() *cty.Value // ArchiveOnDestroyValue return the `github_repository` `archive_on_destroy` attribute value. // // If `nil` is returned, attribute will be omitted ArchiveOnDestroyValue() *cty.Value // PagesConfig return the config provider for `github_repository->pages` block PagesConfig() PagesConfigProvider // TemplateConfig return the config provider for `github_repository->template` block TemplateConfig() TemplateConfigProvider }
ConfigProvider defines required methods to be used when creating `github_repository` terraform resource.
type PagesConfig ¶
type PagesConfig struct {
Source *PagesSourceConfig
}
PagesConfig is the default implementation of `PagesConfigProvider`.
func (*PagesConfig) HasResource ¶
func (c *PagesConfig) HasResource() bool
HasResource returns `true` in case `Source` config exists and has resource, else `false`.
func (*PagesConfig) SourceConfig ¶
func (c *PagesConfig) SourceConfig() PagesSourceConfigProvider
SourceConfig returns the provided `PagesSourceConfigProvider`.
type PagesConfigProvider ¶
type PagesConfigProvider interface { // HasResource will indicate if resource has to be created (return `true` for instance to always create the // resource even if empty) HasResource() bool // SourceConfig return the config provider for `github_repository->pages->source` block SourceConfig() PagesSourceConfigProvider }
PagesConfigProvider defines required methods to be used when creating `github_repository->pages` terraform block.
type PagesSourceConfig ¶
PagesSourceConfig is the default implementation of `PagesSourceConfigProvider`.
func (*PagesSourceConfig) BranchValue ¶
func (c *PagesSourceConfig) BranchValue() *cty.Value
BranchValue returns the provided `github_repository->pages->source` `branch` attribute value as `cty.String` or `nil` if not provided.
func (*PagesSourceConfig) HasResource ¶
func (c *PagesSourceConfig) HasResource() bool
HasResource returns `true` in case `Branch` value exists, else `false`.
func (*PagesSourceConfig) PathValue ¶
func (c *PagesSourceConfig) PathValue() *cty.Value
PathValue returns the provided `github_repository->pages->source` `path` attribute value as `cty.String` or `nil` if not provided.
type PagesSourceConfigProvider ¶
type PagesSourceConfigProvider interface { // HasResource will indicate if resource has to be created (return `true` for instance to always create the // resource even if empty) HasResource() bool // BranchValue return the `github_repository->pages->source` `branch` attribute value. // // If `nil` is returned, attribute will be omitted BranchValue() *cty.Value // PathValue return the `github_repository->pages->source` `path` attribute value. // // If `nil` is returned, attribute will be omitted PathValue() *cty.Value }
PagesSourceConfigProvider defines required methods to be used when creating `github_repository->pages->source` terraform block.
type TemplateConfig ¶
TemplateConfig is the default implementation of `TemplateConfigProvider`.
func (*TemplateConfig) HasResource ¶
func (c *TemplateConfig) HasResource() bool
HasResource returns `true` in case both `Repository` and `Owner` values exist, else `false`.
func (*TemplateConfig) OwnerValue ¶
func (c *TemplateConfig) OwnerValue() *cty.Value
OwnerValue returns the provided `github_repository->template` `owner` attribute value as `cty.String` or `nil` if not provided.
func (*TemplateConfig) RepositoryValue ¶
func (c *TemplateConfig) RepositoryValue() *cty.Value
RepositoryValue returns the provided `github_repository->template` `repository` attribute value as `cty.String` or `nil` if not provided.
type TemplateConfigProvider ¶
type TemplateConfigProvider interface { // HasResource will indicate if resource has to be created (return `true` for instance to always create the // resource even if empty) HasResource() bool // OwnerValue return the `github_repository->template` `owner` attribute value. // // If `nil` is returned, attribute will be omitted OwnerValue() *cty.Value // RepositoryValue return the `github_repository->template` `repository` attribute value. // // If `nil` is returned, attribute will be omitted RepositoryValue() *cty.Value }
TemplateConfigProvider defines required methods to be used when creating `github_repository->template` terraform block.