Skip to content

Commit

Permalink
Fix atlantis projects generation (#206)
Browse files Browse the repository at this point in the history
* Fix `atlantis` projects generation

* Auto Format

* Fix `atlantis` projects generation

Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>
  • Loading branch information
aknysh and cloudpossebot committed Sep 24, 2022
1 parent 9f3993c commit 0ddcd73
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 25 deletions.
1 change: 1 addition & 0 deletions .github/workflows/validate-codeowners.yml
Expand Up @@ -10,6 +10,7 @@ jobs:
steps:
- name: "Checkout source code at current commit"
uses: actions/checkout@v2
# Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved
- uses: mszostok/codeowners-validator@v0.7.1
if: github.event.pull_request.head.repo.full_name == github.repository
name: "Full check of CODEOWNERS"
Expand Down
4 changes: 2 additions & 2 deletions atmos.yaml
Expand Up @@ -172,8 +172,8 @@ integrations:
when_modified:
- "**/*.tf"
- "varfiles/$PROJECT_NAME.tfvars.json"
apply_requirements:
- "approved"
apply_requirements:
- "approved"

# Workflow templates
# https://www.runatlantis.io/docs/custom-workflows.html#custom-init-plan-apply-commands
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/Dockerfile
@@ -1,8 +1,8 @@
# Geodesic: https://github.com/cloudposse/geodesic/
ARG GEODESIC_VERSION=1.3.0
ARG GEODESIC_VERSION=1.3.1
ARG GEODESIC_OS=debian
# atmos: https://github.com/cloudposse/atmos
ARG ATMOS_VERSION=1.8.0
ARG ATMOS_VERSION=1.8.2
# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.2.9

Expand Down
4 changes: 2 additions & 2 deletions examples/complete/atmos.yaml
Expand Up @@ -172,8 +172,8 @@ integrations:
when_modified:
- "**/*.tf"
- "varfiles/$PROJECT_NAME.tfvars.json"
apply_requirements:
- "approved"
apply_requirements:
- "approved"

# Workflow templates
# https://www.runatlantis.io/docs/custom-workflows.html#custom-init-plan-apply-commands
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/rootfs/usr/local/etc/atmos/atmos.yaml
Expand Up @@ -172,8 +172,8 @@ integrations:
when_modified:
- "**/*.tf"
- "varfiles/$PROJECT_NAME.tfvars.json"
apply_requirements:
- "approved"
apply_requirements:
- "approved"

# Workflow templates
# https://www.runatlantis.io/docs/custom-workflows.html#custom-init-plan-apply-commands
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -7,7 +7,7 @@ require (
github.com/fatih/color v1.13.0
github.com/hashicorp/go-getter v1.6.2
github.com/hashicorp/hcl v1.0.0
github.com/hashicorp/hcl/v2 v2.14.0
github.com/hashicorp/hcl/v2 v2.14.1
github.com/imdario/mergo v0.3.13
github.com/json-iterator/go v1.1.12
github.com/mitchellh/go-homedir v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -223,8 +223,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/hcl/v2 v2.14.0 h1:jX6+Q38Ly9zaAJlAjnFVyeNSNCKKW8D0wvyg7vij5Wc=
github.com/hashicorp/hcl/v2 v2.14.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/hashicorp/hcl/v2 v2.14.1 h1:x0BpjfZ+CYdbiz+8yZTQ+gdLO7IXvOut7Da+XJayx34=
github.com/hashicorp/hcl/v2 v2.14.1/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
Expand Down
6 changes: 3 additions & 3 deletions internal/exec/atlantis_generate_repo_config.go
Expand Up @@ -195,9 +195,8 @@ func ExecuteAtlantisGenerateRepoConfig(
}

atlantisProjectAutoplanConfig := c.AtlantisProjectAutoplanConfig{
Enabled: projectTemplate.Autoplan.Enabled,
ApplyRequirements: projectTemplate.Autoplan.ApplyRequirements,
WhenModified: whenModified,
Enabled: projectTemplate.Autoplan.Enabled,
WhenModified: whenModified,
}

atlantisProjectName := c.ReplaceContextTokens(context, projectTemplate.Name)
Expand All @@ -210,6 +209,7 @@ func ExecuteAtlantisGenerateRepoConfig(
TerraformVersion: projectTemplate.TerraformVersion,
DeleteSourceBranchOnMerge: projectTemplate.DeleteSourceBranchOnMerge,
Autoplan: atlantisProjectAutoplanConfig,
ApplyRequirements: projectTemplate.ApplyRequirements,
}

atlantisProjects = append(atlantisProjects, atlantisProject)
Expand Down
12 changes: 6 additions & 6 deletions pkg/atlantis/README.md
Expand Up @@ -86,8 +86,8 @@ integrations:
when_modified:
- "**/*.tf"
- "varfiles/$PROJECT_NAME.tfvars.json"
apply_requirements:
- "approved"
apply_requirements:
- "approved"

# Workflow templates
# https://www.runatlantis.io/docs/custom-workflows.html#custom-init-plan-apply-commands
Expand Down Expand Up @@ -131,8 +131,8 @@ projects:
when_modified:
- '**/*.tf'
- varfiles/tenant1-ue2-staging-test-test-component-override-3.tfvars.json
apply_requirements:
- approved
apply_requirements:
- approved
- name: tenant1-ue2-staging-infra-vpc
workspace: tenant1-ue2-staging
workflow: workflow-1
Expand All @@ -144,8 +144,8 @@ projects:
when_modified:
- '**/*.tf'
- varfiles/tenant1-ue2-staging-infra-vpc.tfvars.json
apply_requirements:
- approved
apply_requirements:
- approved
workflows:
workflow-1:
apply:
Expand Down
4 changes: 2 additions & 2 deletions pkg/atlantis/atmos.yaml
Expand Up @@ -106,8 +106,8 @@ integrations:
when_modified:
- "**/*.tf"
- "varfiles/$PROJECT_NAME.tfvars.json"
apply_requirements:
- "approved"
apply_requirements:
- "approved"

# Workflow templates
# https://www.runatlantis.io/docs/custom-workflows.html#custom-init-plan-apply-commands
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/schema.go
Expand Up @@ -265,12 +265,12 @@ type AtlantisProjectConfig struct {
TerraformVersion string `yaml:"terraform_version" json:"terraform_version" mapstructure:"terraform_version"`
DeleteSourceBranchOnMerge bool `yaml:"delete_source_branch_on_merge" json:"delete_source_branch_on_merge" mapstructure:"delete_source_branch_on_merge"`
Autoplan AtlantisProjectAutoplanConfig `yaml:"autoplan" json:"autoplan" mapstructure:"autoplan"`
ApplyRequirements []string `yaml:"apply_requirements" json:"apply_requirements" mapstructure:"apply_requirements"`
}

type AtlantisProjectAutoplanConfig struct {
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
WhenModified []string `yaml:"when_modified" json:"when_modified" mapstructure:"when_modified"`
ApplyRequirements []string `yaml:"apply_requirements" json:"apply_requirements" mapstructure:"apply_requirements"`
Enabled bool `yaml:"enabled" json:"enabled" mapstructure:"enabled"`
WhenModified []string `yaml:"when_modified" json:"when_modified" mapstructure:"when_modified"`
}

type AtlantisConfigOutput struct {
Expand Down

0 comments on commit 0ddcd73

Please sign in to comment.