Skip to content

Commit

Permalink
Acquire Cloud.gov secrets from AWS parameter store via a Terraform da…
Browse files Browse the repository at this point in the history
…ta lookup. (#189)

Context: this allows us to easily have separate service accounts for each deployment environment, and rotate credentials.
  • Loading branch information
danielnaab authored Jun 17, 2024
1 parent 4418402 commit a790b76
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
5 changes: 4 additions & 1 deletion infra/cdktf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"app": "npx ts-node src/index.ts",
"projectId": "9bbe7827-9202-4cf8-8d85-a8241c08ab5c",
"sendCrashReports": "false",
"terraformProviders": ["cloudfoundry-community/[email protected]"],
"terraformProviders": [
"hashicorp/[email protected]",
"cloudfoundry-community/[email protected]"
],
"terraformModules": [],
"context": {
"excludeStackIdFromLogicalIds": "true",
Expand Down
5 changes: 2 additions & 3 deletions infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@cdktf/provider-aws": "18.0.1",
"cdktf": "^0.20.4",
"cdktf-cli": "^0.20.4",
"cdktf": "^0.20.7",
"cdktf-cli": "^0.20.7",
"constructs": "^10.3.0"
},
"devDependencies": {
Expand Down
28 changes: 24 additions & 4 deletions infra/src/lib/app-stack.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { App, TerraformStack } from 'cdktf';
import { Construct } from 'constructs';

import { AwsProvider } from '../../.gen/providers/aws/provider';
import { CloudfoundryProvider } from '../../.gen/providers/cloudfoundry/provider';

import { withBackend } from './backend';
import { CloudGovSpace } from './cloud.gov/space';
import { DataAwsSsmParameter } from '../../.gen/providers/aws/data-aws-ssm-parameter';

export const registerAppStack = (stackPrefix: string) => {
const app = new App();
Expand All @@ -16,18 +19,35 @@ class AppStack extends TerraformStack {
constructor(scope: Construct, id: string) {
super(scope, id);

/*new AwsProvider(this, 'AWS', {
new AwsProvider(this, 'AWS', {
region: 'us-east-2',
});*/
});

const cfUsername = new DataAwsSsmParameter(
this,
`${id}-cloudfoundry-username`,
{
name: `/${id}/cloudfoundry/username`,
}
);
const cfPassword = new DataAwsSsmParameter(
this,
`${id}-cloudfoundry-password`,
{
name: `/${id}/cloudfoundry/password`,
}
);

new CloudfoundryProvider(this, 'cloud-gov', {
apiUrl: 'https://api.fr.cloud.gov',
appLogsMax: 30,
ssoPasscode: '',
user: cfUsername.value,
password: cfPassword.value,
});

//new Docassemble(this, `${id}-docassemble`);
new CloudGovSpace(this, id);

//new Docassemble(this, `${id}-docassemble`);
//new FormService(this, `${id}-rest-api`);
}
}

0 comments on commit a790b76

Please sign in to comment.