Skip to content

Commit

Permalink
Merge pull request #32 from mineiros-io/mariux/fix-31
Browse files Browse the repository at this point in the history
fix: non-idem-potent applies when referencing repositories with uppercase letters in names
  • Loading branch information
mariux authored Apr 28, 2021
2 parents c72708b + 75cd555 commit 46baf02
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 33 deletions.
41 changes: 39 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,58 +1,95 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.3.1]

### Changed

- Tests now check for idem-potency after applying

### Fixed

- Fixed non-idem-potent applies when referencing repositories with uppercase letters in names (#31)

## [0.3.0]

### Added

- Add support for Terraform v0.14.x

## [0.2.0]

### Added

- Add `CHANGELOG.md`
- Add support for Terraform v0.13.x
- Add support for Terraform Github Provider v3.x
- Prepare support for Terraform v0.14.x (needs terraform v0.12.20 or above)

### Changed

- Switch CI from SemaphoreCI to GitHub Actions

## [0.1.3] - 2020-03-05

### Added

- New format for README.md and LICENSE.

### Changed

- Bump pre-commit hooks to v 0.1.4 and add new hooks.
- Bump build-tools to v0.5.3.

## [0.1.2] - 2020-03-03

### Added

- Upgrade the Github provider to version 2.4.

## [0.1.1] - 2020-03-02

### Added

- Sort go imports.

### Fixed

- Fix some typos in README.md.

## [0.1.0] - 2020-03-02

### Added

- Add readme in markdown syntax instead of asciidoc for `registry.terraform.io`.
- Use pre-commit hooks.
- Add a new Makefile for running common tasks.

### Changelog

- Split up tests and test outputs.

## [0.0.1] - 2020-01-15

### Added

- This is the initial release of our terraform-github-team module that supports
Team, Nested Team, Memberships, Team Repositories.

<!-- markdown-link-check-disable -->
[Unreleased]: https://github.com/mineiros-io/terraform-github-team/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/mineiros-io/terraform-github-team/compare/v0.2.0...v0.3.0

[unreleased]: https://github.com/mineiros-io/terraform-github-team/compare/v0.3.1...HEAD
[0.3.1]: https://github.com/mineiros-io/terraform-github-team/compare/v0.3.0...v0.3.1

<!-- markdown-link-check-enable -->

[0.3.0]: https://github.com/mineiros-io/terraform-github-team/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/mineiros-io/terraform-github-team/compare/v0.1.3...v0.2.0
[0.1.3]: https://github.com/mineiros-io/terraform-github-team/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/mineiros-io/terraform-github-team/compare/v0.1.1...v0.1.2
Expand Down
10 changes: 5 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ resource "github_team_membership" "team_membership" {
}

locals {
repo_admin = { for i in var.admin_repositories : lower(i) => "admin" }
repo_push = { for i in var.push_repositories : lower(i) => "push" }
repo_pull = { for i in var.pull_repositories : lower(i) => "pull" }
repo_admin = { for i in var.admin_repositories : lower(i) => { permission = "admin", repository = i } }
repo_push = { for i in var.push_repositories : lower(i) => { permission = "push", repository = i } }
repo_pull = { for i in var.pull_repositories : lower(i) => { permission = "pull", repository = i } }

repositories = merge(local.repo_admin, local.repo_push, local.repo_pull)
}

resource "github_team_repository" "team_repository" {
for_each = local.repositories

repository = each.key
repository = each.value.repository
team_id = github_team.team.id
permission = each.value
permission = each.value.permission

depends_on = [var.module_depends_on]
}
5 changes: 3 additions & 2 deletions test/github_team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestGithubTeam(t *testing.T) {
t.Parallel()

repositoryA := fmt.Sprintf("a-repository-%s", random.UniqueId())
repositoryB := fmt.Sprintf("b-repository-%s", random.UniqueId())
repositoryB := fmt.Sprintf("B-Repository-%s", random.UniqueId())
teamName := fmt.Sprintf("team-%s", random.UniqueId())

terraformOptions := &terraform.Options{
Expand All @@ -46,5 +46,6 @@ func TestGithubTeam(t *testing.T) {
defer terraform.Destroy(t, terraformOptions)

// This will run `terraform init` and `terraform apply` and fail the test if there are any errors
terraform.InitAndApply(t, terraformOptions)
terraform.InitAndPlan(t, terraformOptions)
terraform.ApplyAndIdempotent(t, terraformOptions)
}
24 changes: 0 additions & 24 deletions test/public-repositories-with-team/outputs.tf

This file was deleted.

0 comments on commit 46baf02

Please sign in to comment.