transcend-io / terragrunt-atlantis-config

Generate Atlantis config for Terragrunt projects.
https://transcend.io/blog/why-we-use-terragrunt
MIT License
613 stars 96 forks source link

Extend AtlantisProject config for generating #351

Open Frezyy123 opened 4 weeks ago

Frezyy123 commented 4 weeks ago

Feature Request

Describe the idea I would like to extend AtlantisProject type for changing options such as RepoLocks and SilencePRComments in generated projects https://www.runatlantis.io/docs/repo-level-atlantis-yaml#repolocks

// config.go
type AtlantisProject struct {
        .......
        RepoLocks RepoLocksConfig `json:"repo_locks,omitempty"`

    // silence_pr_comments silences all comments on PRs for this project
    SilencePRComments []string `json:"silence_pr_comments,omitempty"`
}
type RepoLocksConfig struct {
    // The mode of the repo to lock
    Mode string `json:"mode"`
}

// generate.go
    project := &AtlantisProject{
        Dir:               filepath.ToSlash(relativeSourceDir),
        Workflow:          workflow,
        TerraformVersion:  terraformVersion,
        ApplyRequirements: applyRequirements,
        RepoLocks: RepoLocksConfig{
             Mode: "disabled",  // parsed from arguments
        }
        SilencePRComments: []string{"apply"},  // parsed from arguments
        Autoplan: AutoplanConfig{
            Enabled:      resolvedAutoPlan,
            WhenModified: uniqueStrings(relativeDependencies),
        },
    }

terragrunt-atlantis-config --silence-pr-comments plan --repo-locks disabled

Why is this helpful? It will helps to manage project configuration for terragrunt repositories with atlantis

What alternatives exist today? Bash scripts in pre/post workflow hook