forked from codefresh-io/terraform-provider-codefresh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
125 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
# module teams | ||
# module teams | ||
|
||
[teams source](../../tf_modules/teams) | ||
[teams example](../../examples/teams) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
data "codefresh_team" "admins" { | ||
name = "admins" | ||
} | ||
|
||
data "codefresh_team" "developers" { | ||
name = "developers" | ||
} | ||
|
||
resource "codefresh_permission" "dev_pipeline" { | ||
for_each = toset(["run", "create", "update", "delete", "read"]) | ||
team = data.codefresh_team.developers.id | ||
action = each.value | ||
resource = "pipeline" | ||
tags = [ "dev", "untagged"] | ||
} | ||
|
||
resource "codefresh_permission" "admin_pipeline" { | ||
for_each = toset(["run", "create", "update", "delete", "read", "approve"]) | ||
team = data.codefresh_team.admins.id | ||
action = each.value | ||
resource = "pipeline" | ||
tags = [ "production", "*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
provider "codefresh" { | ||
api_url = var.api_url | ||
token = var.token # If token isn't set the provider expects the $CODEFRESH_API_KEY env variable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
api_url = "https://my-codefresh.example.com/api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
variable api_url { | ||
type = string | ||
} | ||
|
||
variable token { | ||
type = string | ||
default = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
variable api_url { | ||
type = string | ||
} | ||
|
||
variable token { | ||
type = string | ||
default = "" | ||
} | ||
provider "codefresh" { | ||
api_url = var.api_url | ||
token = var.token | ||
} | ||
|
||
variable teams { | ||
type = map(any) | ||
} | ||
|
||
module "teams" { | ||
source = "../../tf_modules/teams" | ||
teams = var.teams | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
api_url = "https://my-codefresh.example.com/api" | ||
token = "" | ||
|
||
teams = { | ||
developers = ["user1", "user3"] | ||
managers = ["user3", "user2"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
data "codefresh_current_account" "acc" { | ||
|
||
} | ||
|
||
locals { | ||
user_ids = tomap({ | ||
for u in data.codefresh_current_account.acc.users: | ||
u.name => u.id | ||
}) | ||
|
||
} | ||
|
||
resource "codefresh_team" "teams" { | ||
for_each = var.teams | ||
name = each.key | ||
|
||
users = [for u in each.value: lookup(local.user_ids, u)] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
output "users" { | ||
value = local.user_ids | ||
} | ||
output "teams" { | ||
value = codefresh_team.teams | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# variable api_url { | ||
# type = string | ||
# } | ||
|
||
# variable token { | ||
# type = string | ||
# default = "" | ||
# } | ||
|
||
# teams map[team_name]usersList | ||
# { | ||
# developers = ["user1", "user3"] | ||
# managers = ["user3", "user2"] | ||
# } | ||
variable teams { | ||
type = map(any) | ||
} |