mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Add egress-space terraform module
This commit is contained in:
36
terraform/shared/egress_space/main.tf
Normal file
36
terraform/shared/egress_space/main.tf
Normal file
@@ -0,0 +1,36 @@
|
||||
###
|
||||
# Target space/org
|
||||
###
|
||||
|
||||
data "cloudfoundry_org" "org" {
|
||||
name = var.cf_org_name
|
||||
}
|
||||
|
||||
###
|
||||
# Egress Space
|
||||
###
|
||||
|
||||
resource "cloudfoundry_space" "public_egress" {
|
||||
name = "${var.cf_restricted_space_name}-egress"
|
||||
org = data.cloudfoundry_org.org.id
|
||||
}
|
||||
|
||||
###
|
||||
# User roles
|
||||
###
|
||||
|
||||
data "cloudfoundry_user" "users" {
|
||||
for_each = var.deployers
|
||||
name = each.key
|
||||
org_id = data.cloudfoundry_org.org.id
|
||||
}
|
||||
|
||||
locals {
|
||||
user_ids = [for user in data.cloudfoundry_user.users : user.id]
|
||||
}
|
||||
|
||||
resource "cloudfoundry_space_users" "deployers" {
|
||||
space = cloudfoundry_space.public_egress.id
|
||||
managers = local.user_ids
|
||||
developers = local.user_ids
|
||||
}
|
||||
16
terraform/shared/egress_space/providers.tf
Normal file
16
terraform/shared/egress_space/providers.tf
Normal file
@@ -0,0 +1,16 @@
|
||||
terraform {
|
||||
required_version = "~> 1.0"
|
||||
required_providers {
|
||||
cloudfoundry = {
|
||||
source = "cloudfoundry-community/cloudfoundry"
|
||||
version = "~> 0.15"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "cloudfoundry" {
|
||||
api_url = "https://api.fr.cloud.gov"
|
||||
user = var.cf_user
|
||||
password = var.cf_password
|
||||
app_logs_max = 30
|
||||
}
|
||||
10
terraform/shared/egress_space/variables.tf
Normal file
10
terraform/shared/egress_space/variables.tf
Normal file
@@ -0,0 +1,10 @@
|
||||
variable "cf_password" {
|
||||
type = string
|
||||
sensitive = true
|
||||
}
|
||||
variable "cf_user" {}
|
||||
variable "cf_org_name" {}
|
||||
variable "cf_restricted_space_name" {}
|
||||
variable "deployers" {
|
||||
type = set(string)
|
||||
}
|
||||
Reference in New Issue
Block a user