@@ -22,8 +22,9 @@ var _ tfsdk.ResourceWithImportState = flyAppResource{}
2222type flyAppResourceType struct {}
2323
2424type flyAppResourceData struct {
25- Name types.String `tfsdk:"name"`
26- Org types.String `tfsdk:"org"`
25+ Name types.String `tfsdk:"name"`
26+ Org types.String `tfsdk:"org"`
27+ OrgId types.String `tfsdk:"orgid"`
2728}
2829
2930func (ar flyAppResourceType ) GetSchema (context.Context ) (tfsdk.Schema , diag.Diagnostics ) {
@@ -40,7 +41,12 @@ func (ar flyAppResourceType) GetSchema(context.Context) (tfsdk.Schema, diag.Diag
4041 "org" : {
4142 Computed : true ,
4243 Optional : true ,
43- MarkdownDescription : "Optional org ID to operate upon" ,
44+ MarkdownDescription : "Optional org slug to operate upon" ,
45+ Type : types .StringType ,
46+ },
47+ "orgid" : {
48+ Computed : true ,
49+ MarkdownDescription : "readonly orgid" ,
4450 Type : types .StringType ,
4551 },
4652 },
@@ -82,7 +88,7 @@ func (r flyAppResource) Create(ctx context.Context, req tfsdk.CreateResourceRequ
8288 resp .Diagnostics .AddError ("Could not resolve organization" , err .Error ())
8389 return
8490 }
85- data .Org .Value = org .Organization .Id
91+ data .OrgId .Value = org .Organization .Id
8692 }
8793
8894 mresp , err := graphql .CreateAppMutation (context .Background (), * r .provider .client , data .Name .Value , data .Org .Value )
@@ -92,8 +98,9 @@ func (r flyAppResource) Create(ctx context.Context, req tfsdk.CreateResourceRequ
9298 }
9399
94100 data = flyAppResourceData {
95- Org : types.String {Value : mresp .CreateApp .App .Organization .Id },
96- Name : types.String {Value : mresp .CreateApp .App .Name },
101+ Org : types.String {Value : mresp .CreateApp .App .Organization .Slug },
102+ OrgId : types.String {Value : mresp .CreateApp .App .Organization .Id },
103+ Name : types.String {Value : mresp .CreateApp .App .Name },
97104 }
98105
99106 diags = resp .State .Set (ctx , & data )
@@ -127,8 +134,9 @@ func (r flyAppResource) Read(ctx context.Context, req tfsdk.ReadResourceRequest,
127134 }
128135
129136 data = flyAppResourceData {
130- Name : types.String {Value : query .App .Name },
131- Org : types.String {Value : query .App .Organization .Id },
137+ Name : types.String {Value : query .App .Name },
138+ Org : types.String {Value : query .App .Organization .Slug },
139+ OrgId : types.String {Value : query .App .Organization .Id },
132140 }
133141
134142 diags = resp .State .Set (ctx , & data )
0 commit comments