Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import notify-management space #931

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions terraform/bootstrap/imports.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The notify-management space contains resources that don't belong in our
# deployed environment spaces (notify-sandbox, etc.) including:
# * the bucket that holds Terraform state
# * supplemental service brokers, letting cloud.gov provision AWS services
# * some service accounts used for deployment

import {
to = cloudfoundry_space.notify-management
id = "a022fabe-056c-4329-9d4f-3f7a67442d36"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling out the fact that with the way this is done, which is very straightforward and makes sense, I'm assuming this'll be the approach for the other spaces that aren't currently under Terraform management (e.g., notify-staging)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! This is the technique I think we should use to bring other spaces into Terraform

24 changes: 23 additions & 1 deletion terraform/bootstrap/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
locals {
cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-management"
s3_service_name = "notify-terraform-state"
}

data "cloudfoundry_org" "org" {
name = local.cf_org_name
}

resource "cloudfoundry_space" "notify-management" {
delete_recursive_allowed = false
name = local.cf_space_name
org = data.cloudfoundry_org.org.id
asgs = [
"71d5aa70-fdce-46fa-8494-aabdb8cae381", # trusted_local_networks_egress
"c70d6061-4da3-4cbb-bd8e-c9982a5e8b22", # public_networks_egress
# Public egress is needed for service brokers's Terraform to reach AWS APIs
]
lifecycle {
# Never delete the bucket that holds Terraform state nor the other
# important contents of the notify-management space
prevent_destroy = true
}
}

module "s3" {
source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1"

cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-management"
cf_space_name = local.cf_space_name
name = local.s3_service_name
}

Expand Down