Skip to content

Commit 982c547

Browse files
committed
fix linter
1 parent aad4f73 commit 982c547

11 files changed

Lines changed: 58 additions & 60 deletions

File tree

src/integrations/aws_integration_automation/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ Deploys JIT integration across an entire AWS Organization using a CloudFormation
3131
```hcl
3232
module "jit_aws_account_integration" {
3333
source = "path/to/aws_integration_automation"
34-
34+
3535
# JIT Configuration
3636
jit_client_id = var.jit_client_id
3737
jit_secret = var.jit_secret
3838
jit_region = "us" # Use "eu" for European API endpoint
39-
39+
4040
# Integration Type
4141
integration_type = "account"
42-
42+
4343
# AWS Configuration
4444
aws_regions_to_monitor = ["us-east-1", "us-west-2"]
45-
45+
4646
# Stack Configuration
4747
stack_name = "JitAccountIntegration"
4848
account_name = "Production Account"
4949
resource_name_prefix = "JitProd"
50-
50+
5151
# CloudFormation Configuration
5252
capabilities = ["CAPABILITY_NAMED_IAM"]
5353
}
@@ -58,26 +58,26 @@ module "jit_aws_account_integration" {
5858
```hcl
5959
module "jit_aws_org_integration" {
6060
source = "path/to/aws_integration_automation"
61-
61+
6262
# JIT Configuration
6363
jit_client_id = var.jit_client_id
6464
jit_secret = var.jit_secret
6565
jit_region = "us" # Use "eu" for European API endpoint
66-
66+
6767
# Integration Type
6868
integration_type = "org"
69-
69+
7070
# Organization Configuration
7171
organization_root_id = "r-xxxxxxxxxxxx"
7272
should_include_root_account = true
73-
73+
7474
# AWS Configuration
7575
aws_regions_to_monitor = ["us-east-1", "us-west-2", "eu-west-1"]
76-
76+
7777
# Stack Configuration
7878
stack_name = "JitOrgIntegration"
7979
resource_name_prefix = "JitOrg"
80-
80+
8181
# CloudFormation Configuration
8282
capabilities = ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
8383
}
@@ -194,7 +194,7 @@ terraform plan
194194
terraform apply
195195
```
196196

197-
### Organization Integration
197+
### Organization Integration
198198
- **Directory**: [`examples/aws_organization/`](examples/aws_organization/)
199199
- **Main File**: `organization_integration.tf`
200200
- **Variables**: `variables.tf`
@@ -282,4 +282,4 @@ terraform apply
282282

283283
## License
284284

285-
This module is part of the JIT customer scripts repository. Please refer to the main repository license for usage terms.
285+
This module is part of the JIT customer scripts repository. Please refer to the main repository license for usage terms.

src/integrations/aws_integration_automation/examples/aws_organization/organization_integration.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
terraform {
55
required_version = ">= 1.5"
6-
6+
77
required_providers {
88
aws = {
99
source = "hashicorp/aws"
@@ -20,24 +20,24 @@ provider "aws" {
2020
# Organization Integration Module
2121
module "jit_aws_org_integration" {
2222
source = "../../"
23-
23+
2424
# Jit API Configuration
2525
jit_client_id = var.jit_client_id # Set via environment variable or terraform.tfvars
2626
jit_secret = var.jit_secret # Set via environment variable or terraform.tfvars
2727
jit_region = "us" # Use "eu" for European API endpoint
28-
28+
2929
# Integration Configuration
3030
integration_type = "org"
3131
aws_regions_to_monitor = var.regions_to_monitor
32-
32+
3333
# Organization Configuration
3434
organization_root_id = var.organization_root_id # Your AWS Organization Root ID
3535
should_include_root_account = var.should_include_root_account # Whether to include the management account
36-
36+
3737
# Stack Configuration
3838
stack_name = "JitOrgIntegration"
3939
resource_name_prefix = var.resource_name_prefix # Optional: Prefix for CloudFormation resources
40-
40+
4141
# CloudFormation Configuration
4242
capabilities = ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
4343
}

src/integrations/aws_integration_automation/examples/aws_organization/terraform.tfvars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Follow the guide here - https://docs.jit.io/reference/credentials
33
# Create creds using "Engineering Manager" role
44
jit_client_id = "JIT_API_KEY_CLIENT_ID"
5-
jit_secret = "JIT_API_KEY_SECRET"
5+
jit_secret = "JIT_API_KEY_SECRET"
66

77
# Should manage also the root account in Jit (false to avoid it)
88
should_include_root_account = true
@@ -17,4 +17,4 @@ regions_to_monitor = ["us-east-1", "us-west-2"]
1717
aws_region = "us-east-1"
1818

1919
# Prefix for the resource name
20-
resource_name_prefix = "JitOrg"
20+
resource_name_prefix = "JitOrg"

src/integrations/aws_integration_automation/examples/aws_organization/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ variable "resource_name_prefix" {
3838
description = "Prefix for the resource name"
3939
type = string
4040
default = "JitOrg"
41-
}
41+
}

src/integrations/aws_integration_automation/examples/single_account/account_integration.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
terraform {
55
required_version = ">= 1.5"
6-
6+
77
required_providers {
88
aws = {
99
source = "hashicorp/aws"
@@ -20,21 +20,21 @@ provider "aws" {
2020
# Single Account Integration Module
2121
module "jit_aws_account_integration" {
2222
source = "../../"
23-
23+
2424
# Jit API Configuration
2525
jit_client_id = var.jit_client_id # Set via environment variable or terraform.tfvars
2626
jit_secret = var.jit_secret # Set via environment variable or terraform.tfvars
2727
jit_region = "us" # Use "eu" for European API endpoint
28-
28+
2929
# Integration Configuration
3030
integration_type = "account"
3131
aws_regions_to_monitor = var.regions_to_monitor
32-
32+
3333
# Stack Configuration
3434
stack_name = "JitAccountIntegration"
3535
account_name = var.account_name # Optional: Display name in Jit platform
3636
resource_name_prefix = var.resource_name_prefix # Optional: Prefix for CloudFormation resources
37-
37+
3838
# CloudFormation Configuration
3939
capabilities = ["CAPABILITY_NAMED_IAM"]
4040
}

src/integrations/aws_integration_automation/examples/single_account/terraform.tfvars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Follow the guide here - https://docs.jit.io/reference/credentials
33
# Create creds using "Engineering Manager" role
44
jit_client_id = "JIT_API_KEY_CLIENT_ID"
5-
jit_secret = "JIT_API_KEY_SECRET"
5+
jit_secret = "JIT_API_KEY_SECRET"
66

77
# AWS regions to monitor using Jit
88
regions_to_monitor = ["us-east-1", "us-west-2"]
@@ -14,4 +14,4 @@ aws_region = "us-east-1"
1414
resource_name_prefix = "JitProd"
1515

1616
# Name of the account to monitor
17-
account_name = "My AWS Account"
17+
account_name = "My AWS Account"

src/integrations/aws_integration_automation/examples/single_account/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ variable "resource_name_prefix" {
3131
description = "Prefix for the resource name"
3232
type = string
3333
default = "JitProd"
34-
}
34+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
locals {
22
# JIT API Configuration
33
jit_api_endpoint = var.jit_region == "us" ? "https://api.jit.io" : "https://api.eu.jit.io"
4-
4+
55
# CloudFormation template URLs based on integration type
66
cloudformation_template_url = var.integration_type == "org" ? "https://jit-aws-prod.s3.amazonaws.com/jit_aws_org_integration_stack.json" : "https://jit-aws-prod.s3.amazonaws.com/jit_aws_integration_stack.json"
7-
7+
88
# Resource name prefix with integration-specific defaults
99
resource_name_prefix = var.resource_name_prefix != null ? var.resource_name_prefix : (var.integration_type == "org" ? "JitOrg" : "Jit")
10-
10+
1111
# Base extra parameters for state token request
1212
base_extra_params = {
1313
regions_to_monitor = var.aws_regions_to_monitor
1414
integration_type = var.integration_type
1515
}
16-
16+
1717
# Additional parameters for organization integration
1818
org_extra_params = var.integration_type == "org" ? {
1919
organizationRootId = var.organization_root_id
2020
shouldIncludeRootAccount = var.should_include_root_account
2121
} : {}
22-
22+
2323
# State token request body with correct structure
2424
state_token_request_body = {
2525
vendor = "aws"
@@ -29,4 +29,4 @@ locals {
2929
local.org_extra_params
3030
)
3131
}
32-
}
32+
}

src/integrations/aws_integration_automation/main.tf

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ provider "restapi" {
33
uri = local.jit_api_endpoint
44
write_returns_object = true
55
create_returns_object = true
6-
6+
77
headers = {
88
"Accept" = "application/json"
99
"Content-Type" = "application/json"
@@ -15,17 +15,17 @@ provider "restapi" {
1515
data "http" "jit_auth" {
1616
url = "${local.jit_api_endpoint}/authentication/login"
1717
method = "POST"
18-
18+
1919
request_headers = {
2020
"Accept" = "application/json"
2121
"Content-Type" = "application/json"
2222
}
23-
23+
2424
request_body = jsonencode({
2525
clientId = var.jit_client_id
2626
secret = var.jit_secret
2727
})
28-
28+
2929
lifecycle {
3030
postcondition {
3131
condition = self.status_code == 200
@@ -43,34 +43,34 @@ resource "restapi_object" "jit_state_token" {
4343
ignore_changes_to = ["token"]
4444
# Request body with state token parameters
4545
data = jsonencode(local.state_token_request_body)
46-
46+
4747
# Ignore changes to data since read endpoint returns different structure
4848
lifecycle {
4949
ignore_changes = [data]
5050
}
51-
51+
5252
depends_on = [data.http.jit_auth]
5353
}
5454

5555
# CloudFormation Stack for single account integration
5656
resource "aws_cloudformation_stack" "jit_integration_account" {
5757
count = var.integration_type == "account" ? 1 : 0
58-
58+
5959
name = var.stack_name
6060
template_url = local.cloudformation_template_url
6161
capabilities = var.capabilities
62-
62+
6363
parameters = {
6464
"ExternalId" = jsondecode(restapi_object.jit_state_token.create_response)["token"]
6565
"ResourceNamePrefix" = local.resource_name_prefix
6666
"AccountName" = var.account_name
6767
"ShouldIncludeRootAccount" = tostring(var.should_include_root_account)
6868
}
69-
69+
7070
lifecycle {
7171
prevent_destroy = true
7272
}
73-
73+
7474
depends_on = [
7575
data.http.jit_auth,
7676
restapi_object.jit_state_token
@@ -80,26 +80,24 @@ resource "aws_cloudformation_stack" "jit_integration_account" {
8080
# CloudFormation Stack for organization integration
8181
resource "aws_cloudformation_stack" "jit_integration_org" {
8282
count = var.integration_type == "org" ? 1 : 0
83-
83+
8484
name = var.stack_name
8585
template_url = local.cloudformation_template_url
8686
capabilities = var.capabilities
87-
87+
8888
parameters = {
8989
"ExternalId" = jsondecode(restapi_object.jit_state_token.create_response)["token"]
9090
"ResourceNamePrefix" = local.resource_name_prefix
9191
"OrganizationRootId" = var.organization_root_id
9292
"ShouldIncludeRootAccount" = tostring(var.should_include_root_account)
9393
}
94-
94+
9595
lifecycle {
9696
prevent_destroy = true
9797
}
98-
98+
9999
depends_on = [
100100
data.http.jit_auth,
101101
restapi_object.jit_state_token
102102
]
103103
}
104-
105-

src/integrations/aws_integration_automation/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ variable "resource_name_prefix" {
5353
default = null
5454
validation {
5555
condition = var.resource_name_prefix == null || (
56-
length(var.resource_name_prefix) >= 1 &&
57-
length(var.resource_name_prefix) <= 40 &&
56+
length(var.resource_name_prefix) >= 1 &&
57+
length(var.resource_name_prefix) <= 40 &&
5858
can(regex("^[a-zA-Z0-9-_]*$", var.resource_name_prefix))
5959
)
6060
error_message = "The resource_name_prefix must be 1-40 characters and contain only alphanumeric characters, hyphens, and underscores."
@@ -81,4 +81,4 @@ variable "capabilities" {
8181
description = "CloudFormation capabilities required for stack creation"
8282
type = list(string)
8383
default = ["CAPABILITY_NAMED_IAM"]
84-
}
84+
}

0 commit comments

Comments
 (0)