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

Remove obsolete documentation #342

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions docs/vendors/terraform/terraform-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,80 +18,6 @@ resource "spacelift_stack" "managed-stack" {
}
```

That's awesome. But can we put Terraform to good use and integrate it with resources from a completely different provider? Sure we can, and we have a good excuse, too. Stacks accessibility can be managed [by GitHub teams](../../concepts/stack/README.md#access-readers-and-writers-teams), so why don't we define some?
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we want to replace this with an up-to-date example instead of deleting it?

Without this, the "Taking it for a spin" section is underwhelming. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we point to the terraform starter guide on GitHub?
I think that's the only hands-on terraform guide that we have that guides you through using the Spacelift provider.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea. I hate duplicating content. 👍


```terraform title="stack-and-teams.tf"
resource "github_team" "stack-readers" {
name = "managed-stack-readers"
}

resource "github_team" "stack-writers" {
name = "managed-stack-writers"
}

resource "spacelift_stack" "managed-stack" {
name = "Stack managed by Spacelift"

# Source code.
repository = "testing-spacelift"
branch = "master"

# Access.
readers_team = github_team.stack_readers.slug
writers_team = github_team.stack_writers.slug
}
```

Now that we programmatically combine Spacelift and GitHub resources, let's add AWS to the mix and give our new stack a dedicated [IAM role](../../integrations/cloud-providers/aws.md):

```terraform title="stack-teams-and-iam.tf"
resource "github_team" "stack-readers" {
name = "managed-stack-readers"
}

resource "github_team" "stack-writers" {
name = "managed-stack-writers"
}

resource "spacelift_stack" "managed-stack" {
name = "Stack managed by Spacelift"

# Source code.
repository = "testing-spacelift"
branch = "master"

# Access.
readers_team = github_team.stack_readers.slug
writers_team = github_team.stack_writers.slug
}

# IAM role.
resource "aws_iam_role" "managed-stack" {
name = "spacelift-managed-stack"

assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
jsondecode(
spacelift_stack.managed-stack.aws_assume_role_policy_statement
)
]
})
}

# Attaching a nice, powerful policy to it.
resource "aws_iam_role_policy_attachment" "managed-stack" {
role = aws_iam_role.managed-stack.name
policy_arn = "arn:aws:iam::aws:policy/PowerUserAccess"
}

# Telling Spacelift stack to assume it.
resource "spacelift_stack_aws_role" "managed-stack" {
stack_id = spacelift_stack.managed-stack.id
role_arn = aws_iam_role.managed-stack.arn
}
```

!!! success
OK, so who wants to go back to clicking on things in the web GUI? Because you will likely need to do some clicking, too, [at least with your first stack](terraform-provider.md#proposed-workflow).

Expand Down