@@ -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" {
1515data "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
5656resource "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
8181resource "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-
0 commit comments