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

Submodule to onboard AWS account #8

Merged
merged 33 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6d1a066
aws account permissions
shireesh-illumio Sep 30, 2024
95ba888
aws account permissions
shireesh-illumio Sep 30, 2024
79af381
terraform-docs: automated action
github-actions[bot] Sep 30, 2024
3d7dc07
add flow log arns
shireesh-illumio Sep 30, 2024
524153e
terraform-docs: automated action
github-actions[bot] Sep 30, 2024
0f39d2e
fix name
shireesh-illumio Sep 30, 2024
67038c8
review comments fix
shireesh-illumio Oct 1, 2024
d03c65d
terraform-docs: automated action
github-actions[bot] Oct 1, 2024
1708e49
review comments fix
shireesh-illumio Oct 1, 2024
d154230
terraform-docs: automated action
github-actions[bot] Oct 1, 2024
eb7afd1
adding account directly
shireesh-illumio Oct 1, 2024
89e34e4
terraform-docs: automated action
github-actions[bot] Oct 1, 2024
c088f04
fix example
shireesh-illumio Oct 1, 2024
164103e
fix readme
shireesh-illumio Oct 1, 2024
a6daf10
change to default github module
shireesh-illumio Oct 1, 2024
9559b9e
updating to 1.0.1
shireesh-illumio Oct 1, 2024
48cc7ea
Update variables.tf
rlenglet Oct 2, 2024
27e422a
Order variables by alphabetic order in variables.tf
rlenglet Oct 2, 2024
b7be40e
Order variables by alphabetic order in variables.tf
rlenglet Oct 2, 2024
f3f72d2
Update main.tf to add tags and make AWS resource names configurable
rlenglet Oct 2, 2024
eb84380
Rename output.tf to outputs.tf
rlenglet Oct 2, 2024
8b2eff0
terraform-docs: automated action
github-actions[bot] Oct 2, 2024
2959ada
Clean up examples
rlenglet Oct 2, 2024
6c35643
Update README.md
rlenglet Oct 2, 2024
ae77c3f
Update the module version in all examples
rlenglet Oct 2, 2024
b441817
Improve module names in examples
rlenglet Oct 2, 2024
0849992
Improve example
rlenglet Oct 2, 2024
e6f8966
Re-add tfdocs delimiters into README.md
rlenglet Oct 2, 2024
fe593fc
Configure tfdocs GitHub action to regenerate examples README.md files
rlenglet Oct 2, 2024
2282e61
terraform-docs: automated action
github-actions[bot] Oct 2, 2024
adb7f93
terraform-docs: automated action
github-actions[bot] Oct 2, 2024
1a80239
Fix top-level README.md
rlenglet Oct 2, 2024
7fce273
Add missing read permissions
rlenglet Oct 2, 2024
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
12 changes: 11 additions & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Render terraform docs inside the README.md and push changes back to PR branch
- name: Generate README.md for each Terraform nested module and push changes back to PR branch
uses: terraform-docs/[email protected]
with:
working-dir: .
recursive: true
recursive-path: modules
output-file: README.md
output-method: inject
git-push: "true"

- name: Generate README.md for each example and push changes back to PR branch
uses: terraform-docs/[email protected]
with:
working-dir: .
recursive: true
recursive-path: examples
output-file: README.md
output-method: inject
git-push: "true"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

# .tfstate files
*.tfstate
*.tfstate.*
*.tfstate.*

.idea
36 changes: 7 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,16 @@
# Illumio Terraform Submodules
Terraform submodules that add functionality to Illumios terraform provider. See the modules directory for the various sub modules usage.


## Availible Features
1. Onboarding and deploying a cloud-opeartor and credentials to a k8s cluster

## Usage

```
provider "helm" {
kubernetes {
config_path = "~/.kube/config" # Adjust this path as needed
}
}

provider "illumio-cloudsecure" {
client_id = var.illumio_cloudsecure_client_id
client_secret = var.illumio_cloudsecure_client_secret
}

module "k8s_cluster" {
source = "github.com/illumio/terraform-illumio-cloudsecure//modules/k8s_cluster?ref=v0.0.3"
illumio_region = var.illumio_region
name = var.name
description = var.description
}
```
# Illumio CloudSecure Terraform Modules
Terraform submodules that add functionality to Illumio's CloudSecure Terraform provider. See the modules directory for the various submodules' usage.

## Available Nested Modules
* `aws_account`: onboarding of an AWS account with CloudSecure.
* `k8s_cluster`: deployment and onboarding of CloudSecure's `cloud-operator` into a k8s cluster.

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_illumio-cloudsecure"></a> [illumio-cloudsecure](#requirement\_illumio-cloudsecure) | ~> 1.0.9 |
| <a name="requirement_illumio-cloudsecure"></a> [illumio-cloudsecure](#requirement\_illumio-cloudsecure) | ~> 1.0.11 |

## Providers

Expand Down
33 changes: 33 additions & 0 deletions examples/aws_account/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~>3.0 |
| <a name="requirement_illumio-cloudsecure"></a> [illumio-cloudsecure](#requirement\_illumio-cloudsecure) | ~> 1.0.11 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_aws_account_dev"></a> [aws\_account\_dev](#module\_aws\_account\_dev) | github.com/illumio/terraform-illumio-cloudsecure//modules/aws_account | v1.1.0 |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_illumio_cloudsecure_client_id"></a> [illumio\_cloudsecure\_client\_id](#input\_illumio\_cloudsecure\_client\_id) | The OAuth 2 client identifier used to authenticate against the CloudSecure Config API. | `string` | n/a | yes |
| <a name="input_illumio_cloudsecure_client_secret"></a> [illumio\_cloudsecure\_client\_secret](#input\_illumio\_cloudsecure\_client\_secret) | The OAuth 2 client secret used to authenticate against the CloudSecure Config API. | `string` | n/a | yes |

## Outputs

No outputs.
<!-- END_TF_DOCS -->
17 changes: 17 additions & 0 deletions examples/aws_account/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
provider "aws" {
region = "us-west-1"
}

provider "illumio-cloudsecure" {
client_id = var.illumio_cloudsecure_client_id
client_secret = var.illumio_cloudsecure_client_secret
}

module "aws_account_dev" {
source = "github.com/illumio/terraform-illumio-cloudsecure//modules/aws_account?ref=v1.1.0"
name = "Test Account"
tags = {
Name = "CloudSecure Account Policy"
Owner = "Engineering"
}
}
Empty file added examples/aws_account/outputs.tf
Empty file.
18 changes: 18 additions & 0 deletions examples/aws_account/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "illumio_cloudsecure_client_id" {
type = string
description = "The OAuth 2 client identifier used to authenticate against the CloudSecure Config API."
validation {
condition = length(var.name) > 1
error_message = "The illumio_cloudsecure_client_id value must not be empty."
}
}

variable "illumio_cloudsecure_client_secret" {
type = string
sensitive = true
description = "The OAuth 2 client secret used to authenticate against the CloudSecure Config API."
validation {
condition = length(var.name) > 1
error_message = "The illumio_cloudsecure_client_secret value must not be empty."
}
}
12 changes: 12 additions & 0 deletions examples/aws_account/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
required_providers {
illumio-cloudsecure = {
source = "illumio/illumio-cloudsecure"
version = "~> 1.0.11"
}
aws = {
source = "hashicorp/aws"
version = "~>3.0"
}
}
}
12 changes: 3 additions & 9 deletions examples/k8s_cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| Name | Version |
|------|---------|
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | ~>2.15.0 |
| <a name="requirement_illumio-cloudsecure"></a> [illumio-cloudsecure](#requirement\_illumio-cloudsecure) | ~> 1.0.9 |
| <a name="requirement_illumio-cloudsecure"></a> [illumio-cloudsecure](#requirement\_illumio-cloudsecure) | ~> 1.0.11 |

## Providers

Expand All @@ -14,7 +14,7 @@ No providers.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_k8s_cluster"></a> [k8s\_cluster](#module\_k8s\_cluster) | ../../modules/k8s_cluster | n/a |
| <a name="module_k8s_cluster_dev"></a> [k8s\_cluster\_dev](#module\_k8s\_cluster\_dev) | github.com/illumio/terraform-illumio-cloudsecure//modules/k8s_cluster | v1.1.0 |

## Resources

Expand All @@ -24,16 +24,10 @@ No resources.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_description"></a> [description](#input\_description) | The description of the onboarding credential. | `string` | `"Credential to onboard dev clusters in aws-us-west-2 illumio region"` | no |
| <a name="input_illumio_cloudsecure_client_id"></a> [illumio\_cloudsecure\_client\_id](#input\_illumio\_cloudsecure\_client\_id) | The OAuth 2 client identifier used to authenticate against the CloudSecure Config API. | `string` | n/a | yes |
| <a name="input_illumio_cloudsecure_client_secret"></a> [illumio\_cloudsecure\_client\_secret](#input\_illumio\_cloudsecure\_client\_secret) | The OAuth 2 client secret used to authenticate against the CloudSecure Config API. | `string` | n/a | yes |
| <a name="input_illumio_region"></a> [illumio\_region](#input\_illumio\_region) | The Illumio region where the Kubernetes cluster is located. | `string` | `"aws-us-west-2"` | no |
| <a name="input_name"></a> [name](#input\_name) | The name of the onboarding credential and Helm release. | `string` | `"example-release"` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_client_id"></a> [client\_id](#output\_client\_id) | The client\_id to use to onboard k8s clusters. |
| <a name="output_client_secret"></a> [client\_secret](#output\_client\_secret) | The client\_secret to use to onboard k8s clusters. |
No outputs.
<!-- END_TF_DOCS -->
10 changes: 5 additions & 5 deletions examples/k8s_cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ provider "illumio-cloudsecure" {
client_secret = var.illumio_cloudsecure_client_secret
}

module "k8s_cluster" {
source = "github.com/illumio/terraform-illumio-cloudsecure//modules/k8s_cluster?ref=v1.0.0"
illumio_region = var.illumio_region
name = var.name
description = var.description
module "k8s_cluster_dev" {
source = "github.com/illumio/terraform-illumio-cloudsecure//modules/k8s_cluster?ref=v1.1.0"
illumio_region = "aws-us-west-2"
name = "example-release"
description = "Dev cluster in aws-us-west-2"
}
10 changes: 0 additions & 10 deletions examples/k8s_cluster/output.tf

This file was deleted.

Empty file added examples/k8s_cluster/outputs.tf
Empty file.
18 changes: 0 additions & 18 deletions examples/k8s_cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
variable "illumio_region" {
description = "The Illumio region where the Kubernetes cluster is located."
type = string
default = "aws-us-west-2"
}

variable "name" {
description = "The name of the onboarding credential and Helm release."
type = string
default = "example-release"
}

variable "description" {
description = "The description of the onboarding credential."
type = string
default = "Credential to onboard dev clusters in aws-us-west-2 illumio region"
}

variable "illumio_cloudsecure_client_id" {
type = string
description = "The OAuth 2 client identifier used to authenticate against the CloudSecure Config API."
Expand Down
2 changes: 1 addition & 1 deletion examples/k8s_cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
illumio-cloudsecure = {
source = "illumio/illumio-cloudsecure"
version = "~> 1.0.9"
version = "~> 1.0.11"
}
helm = {
source = "hashicorp/helm"
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
illumio-cloudsecure = {
source = "illumio/illumio-cloudsecure"
version = "~> 1.0.9"
version = "~> 1.0.11"
}
}
}
50 changes: 50 additions & 0 deletions modules/aws_account/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.0 |
| <a name="requirement_illumio-cloudsecure"></a> [illumio-cloudsecure](#requirement\_illumio-cloudsecure) | ~> 1.0.11 |
| <a name="requirement_random"></a> [random](#requirement\_random) | ~> 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.0 |
| <a name="provider_illumio-cloudsecure"></a> [illumio-cloudsecure](#provider\_illumio-cloudsecure) | ~> 1.0.11 |
| <a name="provider_random"></a> [random](#provider\_random) | ~> 3.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_iam_role.role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy.protection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
| [aws_iam_role_policy.read](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
| [illumio-cloudsecure_aws_account.account](https://registry.terraform.io/providers/illumio/illumio-cloudsecure/latest/docs/resources/aws_account) | resource |
| [random_uuid.role_secret](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_organizations_organization.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organization) | data source |
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_iam_name_prefix"></a> [iam\_name\_prefix](#input\_iam\_name\_prefix) | The prefix given to all AWS IAM resource names. | `string` | `"IllumioCloudIntegration"` | no |
| <a name="input_illumio_cloudsecure_account_id"></a> [illumio\_cloudsecure\_account\_id](#input\_illumio\_cloudsecure\_account\_id) | The CloudSecure AWS account ID that is given the IAM role. | `string` | `"712001342241"` | no |
| <a name="input_mode"></a> [mode](#input\_mode) | The account's access mode, must be "ReadWrite" (default) or "Read". | `string` | `"ReadWrite"` | no |
| <a name="input_name"></a> [name](#input\_name) | The name of this account in CloudSecure. | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | The optional tags added to every configured AWS resource. | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_role_arn"></a> [role\_arn](#output\_role\_arn) | The ARN of the IAM role granted to the CloudSecure account. |
<!-- END_TF_DOCS -->
Loading