Access the API endpiont over internal interfaces

This commit is contained in:
Ryan Ahearn
2022-09-20 15:30:54 -04:00
parent 51fb5bce98
commit 109bc72d4b
8 changed files with 88 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
data "cloudfoundry_space" "space" {
org_name = var.cf_org_name
name = var.cf_space_name
}
data "cloudfoundry_app" "source_app" {
name_or_id = var.source_app_name
space = data.cloudfoundry_space.space.id
}
data "cloudfoundry_app" "destination_app" {
name_or_id = var.destination_app_name
space = data.cloudfoundry_space.space.id
}
resource "cloudfoundry_network_policy" "internal_route" {
policy {
source_app = data.cloudfoundry_app.source_app.id
destination_app = data.cloudfoundry_app.destination_app.id
port = var.destination_port
}
}

View 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
}

View File

@@ -0,0 +1,13 @@
variable "cf_password" {
type = string
sensitive = true
}
variable "cf_user" {}
variable "cf_org_name" {}
variable "cf_space_name" {}
variable "source_app_name" {}
variable "destination_app_name" {}
variable "destination_port" {
type = string
default = "61443"
}