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

Add Jsonnet native functions. #429

Merged
merged 9 commits into from
Aug 29, 2024
Merged

Add Jsonnet native functions. #429

merged 9 commits into from
Aug 29, 2024

Conversation

fujiwara
Copy link
Owner

@fujiwara fujiwara commented Aug 27, 2024

like ecspresso.

local tfstate = std.native('tfstate');
local env = std.native('env');
local must_env = std.native('must_env');
local ssm = std.native('ssm');
local caller = std.native('caller_identity');
{
  Environment: {
    Variables: {
      FOO: ssm('/hello/foo'), # lookup ssm
    },
  },
  FunctionName: 'hello',
  Handler: 'index.js',
  MemorySize: std.parseInt(env('MEMORY', '128')), // read env
  Role: 'arn:aws:iam::%s:role/LambdaBasicExecutionRole' % caller().Account, // resolve caller AWS Account ID
  Runtime: 'nodejs20.x',
  Timeout: 5,
  TracingConfig: {
    Mode: 'PassThrough',
  },
  VpcConfig: {
    SubnetIds: [
      tfstate('aws_subnet.lambda["az-a"].id'), // lookup tfstate
      tfstate('aws_subnet.lambda["az-b"].id'),
    ],
    SecurityGroupIds: [
      tfstate('aws_security_group.internal["%s"].id' % must_env('WORLD')),
    ],
  },
}

@fujiwara fujiwara marked this pull request as ready for review August 28, 2024 06:15
@fujiwara fujiwara merged commit 0a5374a into v1 Aug 29, 2024
4 checks passed
@fujiwara fujiwara deleted the jsonnet-native-funcs branch August 29, 2024 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant