@mikarinneoracle/oci-cdk-code-only-preview 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -133,7 +133,7 @@ export OCI_FUNCTION_APP_NAME='my-existing-function-app'
133
133
 
134
134
  These settings are optional: `OCI_CODE_ONLY_SOURCE_DIR` (defaults to the current directory), `OCI_FUNCTION_MEMORY_MB` (from `func.yaml`, otherwise `256`), and `OCI_FUNCTION_TIMEOUT_SECONDS` (from `func.yaml`, otherwise `30`). `OCI_TENANCY_ID`, `OCI_REGION`, and `OCI_NAMESPACE` are also optional when they can be resolved from the active OCI CLI profile.
135
135
 
136
- Each deploy re-builds `<function-name>.zip` in the project root and uploads that file. The ZIP has the required `function/` directory at its root, includes source files, and excludes `node_modules`, `.git`, `.tools`, `.terraform`, and `cdktf.out`. A successful code-only destroy removes this ZIP after Terraform has destroyed the Function App and infrastructure. The current preview path is function-only: it does not create an API Gateway because the CLI-managed function OCID is not in Terraform state.
136
+ Each deploy re-builds `<function-name>.zip` in the project root and uploads that file. The ZIP has the required `function/` directory at its root, includes source files, and excludes `node_modules`, `.git`, `.tools`, `.terraform`, and `cdktf.out`. A successful code-only destroy removes this ZIP after Terraform has destroyed the Function App and infrastructure. With the default `OCI_STACK_ACTION=full-stack`, OCDK creates the API Gateway and uses a Terraform data source to resolve the CLI-managed function OCID for its route. The first code-only deploy therefore runs Terraform once to create the Function App, uploads the function, then runs Terraform again to create the Gateway deployment. Set `OCI_STACK_ACTION=function-only` to omit API Gateway.
137
137
 
138
138
  After a successful code-only deploy, OCDK writes the log IDs for `npx ocdk tail:execution-log` automatically.
139
139
 
package/bin/ocdk.js CHANGED
@@ -154,12 +154,26 @@ if (command === 'deploy' && codeOnlyEnabled) {
154
154
  console.error('Missing script: "deploy-code-only". Update @mikarinneoracle/oci-cdk.');
155
155
  process.exit(1);
156
156
  }
157
- const env = {
157
+ const requestedStackAction = (process.env.OCI_STACK_ACTION || 'full-stack').trim().toLowerCase();
158
+ const wantsFullStack = requestedStackAction !== 'function-only' && requestedStackAction !== 'function';
159
+ const baseEnv = {
158
160
  ...process.env,
159
161
  OCI_CODE_ONLY: '1',
160
- OCI_STACK_ACTION: 'function-only',
161
162
  OCI_PROJECT_DIR: projectDir,
162
163
  };
164
+ // On a new project, create the Function App first. Later code-only deploys
165
+ // keep the full Terraform graph, including the existing API Gateway route.
166
+ let hasFunctionApp = false;
167
+ try {
168
+ resolveCodeOnlyFunctionAppId(baseEnv);
169
+ hasFunctionApp = true;
170
+ } catch {
171
+ // No state/output yet: the bootstrap Terraform pass creates the app.
172
+ }
173
+ const env = {
174
+ ...baseEnv,
175
+ OCI_STACK_ACTION: hasFunctionApp ? requestedStackAction : 'function-only',
176
+ };
163
177
  const infrastructure = spawnSync('npm', ['run', '--silent', 'deploy', '--', ...passthroughArgs], {
164
178
  stdio: 'inherit',
165
179
  cwd: root,
@@ -181,6 +195,16 @@ if (command === 'deploy' && codeOnlyEnabled) {
181
195
  env: { ...env, OCI_FUNCTION_APP_ID: functionAppId },
182
196
  });
183
197
  if (result.status !== 0) process.exit(result.status ?? 1);
198
+ if (wantsFullStack && !hasFunctionApp) {
199
+ console.log('Creating API Gateway deployment for the code-only function...');
200
+ const apiGatewayDeploy = spawnSync('npm', ['run', '--silent', 'deploy', '--', ...passthroughArgs], {
201
+ stdio: 'inherit',
202
+ cwd: root,
203
+ shell: false,
204
+ env: { ...baseEnv, OCI_STACK_ACTION: 'full-stack' },
205
+ });
206
+ if (apiGatewayDeploy.status !== 0) process.exit(apiGatewayDeploy.status ?? 1);
207
+ }
184
208
  const logConfig = spawnSync('node', [path.join(root, 'bin', 'write-log-config.js')], {
185
209
  stdio: 'inherit',
186
210
  cwd: projectDir,
@@ -0,0 +1,295 @@
1
+ import { Construct } from 'constructs';
2
+ import * as cdktf from 'cdktf';
3
+ export interface DataOciFunctionsFunctionsConfig extends cdktf.TerraformMetaArguments {
4
+ /**
5
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#application_id DataOciFunctionsFunctions#application_id}
6
+ */
7
+ readonly applicationId: string;
8
+ /**
9
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#display_name DataOciFunctionsFunctions#display_name}
10
+ */
11
+ readonly displayName?: string;
12
+ /**
13
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#id DataOciFunctionsFunctions#id}
14
+ *
15
+ * Please be aware that the id field is automatically added to all resources in Terraform providers using a Terraform provider SDK version below 2.
16
+ * If you experience problems setting this value it might not be settable. Please take a look at the provider documentation to ensure it should be settable.
17
+ */
18
+ readonly id?: string;
19
+ /**
20
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#state DataOciFunctionsFunctions#state}
21
+ */
22
+ readonly state?: string;
23
+ /**
24
+ * filter block
25
+ *
26
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#filter DataOciFunctionsFunctions#filter}
27
+ */
28
+ readonly filter?: DataOciFunctionsFunctionsFilter[] | cdktf.IResolvable;
29
+ }
30
+ export interface DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfig {
31
+ }
32
+ export declare function dataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfigToTerraform(struct?: DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfig): any;
33
+ export declare function dataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfigToHclTerraform(struct?: DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfig): any;
34
+ export declare class DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfigOutputReference extends cdktf.ComplexObject {
35
+ private isEmptyObject;
36
+ /**
37
+ * @param terraformResource The parent resource
38
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
39
+ * @param complexObjectIndex the index of this item in the list
40
+ * @param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
41
+ */
42
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean);
43
+ get internalValue(): DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfig | undefined;
44
+ set internalValue(value: DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfig | undefined);
45
+ get count(): number;
46
+ get strategy(): string;
47
+ }
48
+ export declare class DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfigList extends cdktf.ComplexList {
49
+ protected terraformResource: cdktf.IInterpolatingParent;
50
+ protected terraformAttribute: string;
51
+ protected wrapsSet: boolean;
52
+ /**
53
+ * @param terraformResource The parent resource
54
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
55
+ * @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
56
+ */
57
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean);
58
+ /**
59
+ * @param index the index of the item to return
60
+ */
61
+ get(index: number): DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfigOutputReference;
62
+ }
63
+ export interface DataOciFunctionsFunctionsFunctionsSourceDetails {
64
+ }
65
+ export declare function dataOciFunctionsFunctionsFunctionsSourceDetailsToTerraform(struct?: DataOciFunctionsFunctionsFunctionsSourceDetails): any;
66
+ export declare function dataOciFunctionsFunctionsFunctionsSourceDetailsToHclTerraform(struct?: DataOciFunctionsFunctionsFunctionsSourceDetails): any;
67
+ export declare class DataOciFunctionsFunctionsFunctionsSourceDetailsOutputReference extends cdktf.ComplexObject {
68
+ private isEmptyObject;
69
+ /**
70
+ * @param terraformResource The parent resource
71
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
72
+ * @param complexObjectIndex the index of this item in the list
73
+ * @param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
74
+ */
75
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean);
76
+ get internalValue(): DataOciFunctionsFunctionsFunctionsSourceDetails | undefined;
77
+ set internalValue(value: DataOciFunctionsFunctionsFunctionsSourceDetails | undefined);
78
+ get pbfListingId(): string;
79
+ get sourceType(): string;
80
+ }
81
+ export declare class DataOciFunctionsFunctionsFunctionsSourceDetailsList extends cdktf.ComplexList {
82
+ protected terraformResource: cdktf.IInterpolatingParent;
83
+ protected terraformAttribute: string;
84
+ protected wrapsSet: boolean;
85
+ /**
86
+ * @param terraformResource The parent resource
87
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
88
+ * @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
89
+ */
90
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean);
91
+ /**
92
+ * @param index the index of the item to return
93
+ */
94
+ get(index: number): DataOciFunctionsFunctionsFunctionsSourceDetailsOutputReference;
95
+ }
96
+ export interface DataOciFunctionsFunctionsFunctionsTraceConfig {
97
+ }
98
+ export declare function dataOciFunctionsFunctionsFunctionsTraceConfigToTerraform(struct?: DataOciFunctionsFunctionsFunctionsTraceConfig): any;
99
+ export declare function dataOciFunctionsFunctionsFunctionsTraceConfigToHclTerraform(struct?: DataOciFunctionsFunctionsFunctionsTraceConfig): any;
100
+ export declare class DataOciFunctionsFunctionsFunctionsTraceConfigOutputReference extends cdktf.ComplexObject {
101
+ private isEmptyObject;
102
+ /**
103
+ * @param terraformResource The parent resource
104
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
105
+ * @param complexObjectIndex the index of this item in the list
106
+ * @param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
107
+ */
108
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean);
109
+ get internalValue(): DataOciFunctionsFunctionsFunctionsTraceConfig | undefined;
110
+ set internalValue(value: DataOciFunctionsFunctionsFunctionsTraceConfig | undefined);
111
+ get isEnabled(): cdktf.IResolvable;
112
+ }
113
+ export declare class DataOciFunctionsFunctionsFunctionsTraceConfigList extends cdktf.ComplexList {
114
+ protected terraformResource: cdktf.IInterpolatingParent;
115
+ protected terraformAttribute: string;
116
+ protected wrapsSet: boolean;
117
+ /**
118
+ * @param terraformResource The parent resource
119
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
120
+ * @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
121
+ */
122
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean);
123
+ /**
124
+ * @param index the index of the item to return
125
+ */
126
+ get(index: number): DataOciFunctionsFunctionsFunctionsTraceConfigOutputReference;
127
+ }
128
+ export interface DataOciFunctionsFunctionsFunctions {
129
+ }
130
+ export declare function dataOciFunctionsFunctionsFunctionsToTerraform(struct?: DataOciFunctionsFunctionsFunctions): any;
131
+ export declare function dataOciFunctionsFunctionsFunctionsToHclTerraform(struct?: DataOciFunctionsFunctionsFunctions): any;
132
+ export declare class DataOciFunctionsFunctionsFunctionsOutputReference extends cdktf.ComplexObject {
133
+ private isEmptyObject;
134
+ /**
135
+ * @param terraformResource The parent resource
136
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
137
+ * @param complexObjectIndex the index of this item in the list
138
+ * @param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
139
+ */
140
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean);
141
+ get internalValue(): DataOciFunctionsFunctionsFunctions | undefined;
142
+ set internalValue(value: DataOciFunctionsFunctionsFunctions | undefined);
143
+ get applicationId(): string;
144
+ get compartmentId(): string;
145
+ private _config;
146
+ get config(): cdktf.StringMap;
147
+ private _definedTags;
148
+ get definedTags(): cdktf.StringMap;
149
+ get displayName(): string;
150
+ private _freeformTags;
151
+ get freeformTags(): cdktf.StringMap;
152
+ get id(): string;
153
+ get image(): string;
154
+ get imageDigest(): string;
155
+ get invokeEndpoint(): string;
156
+ get memoryInMbs(): string;
157
+ private _provisionedConcurrencyConfig;
158
+ get provisionedConcurrencyConfig(): DataOciFunctionsFunctionsFunctionsProvisionedConcurrencyConfigList;
159
+ get shape(): string;
160
+ private _sourceDetails;
161
+ get sourceDetails(): DataOciFunctionsFunctionsFunctionsSourceDetailsList;
162
+ get state(): string;
163
+ get timeCreated(): string;
164
+ get timeUpdated(): string;
165
+ get timeoutInSeconds(): number;
166
+ private _traceConfig;
167
+ get traceConfig(): DataOciFunctionsFunctionsFunctionsTraceConfigList;
168
+ }
169
+ export declare class DataOciFunctionsFunctionsFunctionsList extends cdktf.ComplexList {
170
+ protected terraformResource: cdktf.IInterpolatingParent;
171
+ protected terraformAttribute: string;
172
+ protected wrapsSet: boolean;
173
+ /**
174
+ * @param terraformResource The parent resource
175
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
176
+ * @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
177
+ */
178
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean);
179
+ /**
180
+ * @param index the index of the item to return
181
+ */
182
+ get(index: number): DataOciFunctionsFunctionsFunctionsOutputReference;
183
+ }
184
+ export interface DataOciFunctionsFunctionsFilter {
185
+ /**
186
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#name DataOciFunctionsFunctions#name}
187
+ */
188
+ readonly name: string;
189
+ /**
190
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#regex DataOciFunctionsFunctions#regex}
191
+ */
192
+ readonly regex?: boolean | cdktf.IResolvable;
193
+ /**
194
+ * Docs at Terraform Registry: {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#values DataOciFunctionsFunctions#values}
195
+ */
196
+ readonly values: string[];
197
+ }
198
+ export declare function dataOciFunctionsFunctionsFilterToTerraform(struct?: DataOciFunctionsFunctionsFilter | cdktf.IResolvable): any;
199
+ export declare function dataOciFunctionsFunctionsFilterToHclTerraform(struct?: DataOciFunctionsFunctionsFilter | cdktf.IResolvable): any;
200
+ export declare class DataOciFunctionsFunctionsFilterOutputReference extends cdktf.ComplexObject {
201
+ private isEmptyObject;
202
+ private resolvableValue?;
203
+ /**
204
+ * @param terraformResource The parent resource
205
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
206
+ * @param complexObjectIndex the index of this item in the list
207
+ * @param complexObjectIsFromSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
208
+ */
209
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, complexObjectIndex: number, complexObjectIsFromSet: boolean);
210
+ get internalValue(): DataOciFunctionsFunctionsFilter | cdktf.IResolvable | undefined;
211
+ set internalValue(value: DataOciFunctionsFunctionsFilter | cdktf.IResolvable | undefined);
212
+ private _name?;
213
+ get name(): string;
214
+ set name(value: string);
215
+ get nameInput(): string | undefined;
216
+ private _regex?;
217
+ get regex(): boolean | cdktf.IResolvable;
218
+ set regex(value: boolean | cdktf.IResolvable);
219
+ resetRegex(): void;
220
+ get regexInput(): boolean | cdktf.IResolvable | undefined;
221
+ private _values?;
222
+ get values(): string[];
223
+ set values(value: string[]);
224
+ get valuesInput(): string[] | undefined;
225
+ }
226
+ export declare class DataOciFunctionsFunctionsFilterList extends cdktf.ComplexList {
227
+ protected terraformResource: cdktf.IInterpolatingParent;
228
+ protected terraformAttribute: string;
229
+ protected wrapsSet: boolean;
230
+ internalValue?: DataOciFunctionsFunctionsFilter[] | cdktf.IResolvable;
231
+ /**
232
+ * @param terraformResource The parent resource
233
+ * @param terraformAttribute The attribute on the parent resource this class is referencing
234
+ * @param wrapsSet whether the list is wrapping a set (will add tolist() to be able to access an item via an index)
235
+ */
236
+ constructor(terraformResource: cdktf.IInterpolatingParent, terraformAttribute: string, wrapsSet: boolean);
237
+ /**
238
+ * @param index the index of the item to return
239
+ */
240
+ get(index: number): DataOciFunctionsFunctionsFilterOutputReference;
241
+ }
242
+ /**
243
+ * Represents a {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions oci_functions_functions}
244
+ */
245
+ export declare class DataOciFunctionsFunctions extends cdktf.TerraformDataSource {
246
+ static readonly tfResourceType = "oci_functions_functions";
247
+ /**
248
+ * Generates CDKTF code for importing a DataOciFunctionsFunctions resource upon running "cdktf plan <stack-name>"
249
+ * @param scope The scope in which to define this construct
250
+ * @param importToId The construct id used in the generated config for the DataOciFunctionsFunctions to import
251
+ * @param importFromId The id of the existing DataOciFunctionsFunctions that should be imported. Refer to the {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions#import import section} in the documentation of this resource for the id to use
252
+ * @param provider? Optional instance of the provider where the DataOciFunctionsFunctions to import is found
253
+ */
254
+ static generateConfigForImport(scope: Construct, importToId: string, importFromId: string, provider?: cdktf.TerraformProvider): cdktf.ImportableResource;
255
+ /**
256
+ * Create a new {@link https://registry.terraform.io/providers/hashicorp/oci/5.47.0/docs/data-sources/functions_functions oci_functions_functions} Data Source
257
+ *
258
+ * @param scope The scope in which to define this construct
259
+ * @param id The scoped construct ID. Must be unique amongst siblings in the same scope
260
+ * @param options DataOciFunctionsFunctionsConfig
261
+ */
262
+ constructor(scope: Construct, id: string, config: DataOciFunctionsFunctionsConfig);
263
+ private _applicationId?;
264
+ get applicationId(): string;
265
+ set applicationId(value: string);
266
+ get applicationIdInput(): string | undefined;
267
+ private _displayName?;
268
+ get displayName(): string;
269
+ set displayName(value: string);
270
+ resetDisplayName(): void;
271
+ get displayNameInput(): string | undefined;
272
+ private _functions;
273
+ get functions(): DataOciFunctionsFunctionsFunctionsList;
274
+ private _id?;
275
+ get id(): string;
276
+ set id(value: string);
277
+ resetId(): void;
278
+ get idInput(): string | undefined;
279
+ private _state?;
280
+ get state(): string;
281
+ set state(value: string);
282
+ resetState(): void;
283
+ get stateInput(): string | undefined;
284
+ private _filter;
285
+ get filter(): DataOciFunctionsFunctionsFilterList;
286
+ putFilter(value: DataOciFunctionsFunctionsFilter[] | cdktf.IResolvable): void;
287
+ resetFilter(): void;
288
+ get filterInput(): cdktf.IResolvable | DataOciFunctionsFunctionsFilter[] | undefined;
289
+ protected synthesizeAttributes(): {
290
+ [name: string]: any;
291
+ };
292
+ protected synthesizeHclAttributes(): {
293
+ [name: string]: any;
294
+ };
295
+ }