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

Propagate TF changes (new model, new provider config, and bug fixes) #276

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ORG := ctfer-io
PROJECT := github.com/${ORG}/pulumi-${PACK}
NODE_MODULE_NAME := @ctfer-io/${PACK}
TF_NAME := ${PACK}
PROVIDER_PATH := provider
PROVIDER_PATH := provider/v2
VERSION_PATH := ${PROVIDER_PATH}/pkg/version.Version

TFGEN := pulumi-tfgen-${PACK}
Expand Down
2 changes: 1 addition & 1 deletion docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ let ch = new ctfd.Challenge('some-challenge', {
package main

import (
"github.com/ctfer-io/pulumi-ctfd/sdk/go/ctfd"
"github.com/ctfer-io/pulumi-ctfd/sdk/v2/go/ctfd"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

Expand Down
2 changes: 1 addition & 1 deletion docs/installation-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ For instance, you can set the url using `pulumi config set url https://my-ctf.la
package main

import (
"github.com/ctfer-io/pulumi-ctfd/sdk/go/ctfd"
"github.com/ctfer-io/pulumi-ctfd/sdk/v2/go/ctfd"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
Expand Down
22 changes: 11 additions & 11 deletions provider/cmd/pulumi-resource-ctfd/bridge-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"resources": {
"ctfd_challenge_dynamic": {
"current": "ctfd:index/challengeDynamic:ChallengeDynamic",
"majorVersion": 1,
"majorVersion": 2,
"fields": {
"requirements": {
"fields": {
Expand All @@ -22,7 +22,7 @@
},
"ctfd_challenge_standard": {
"current": "ctfd:index/challengeStandard:ChallengeStandard",
"majorVersion": 1,
"majorVersion": 2,
"fields": {
"requirements": {
"fields": {
Expand All @@ -41,15 +41,15 @@
},
"ctfd_file": {
"current": "ctfd:index/file:File",
"majorVersion": 1
"majorVersion": 2
},
"ctfd_flag": {
"current": "ctfd:index/flag:Flag",
"majorVersion": 1
"majorVersion": 2
},
"ctfd_hint": {
"current": "ctfd:index/hint:Hint",
"majorVersion": 1,
"majorVersion": 2,
"fields": {
"requirements": {
"maxItemsOne": false
Expand All @@ -58,7 +58,7 @@
},
"ctfd_team": {
"current": "ctfd:index/team:Team",
"majorVersion": 1,
"majorVersion": 2,
"fields": {
"members": {
"maxItemsOne": false
Expand All @@ -67,13 +67,13 @@
},
"ctfd_user": {
"current": "ctfd:index/user:User",
"majorVersion": 1
"majorVersion": 2
}
},
"datasources": {
"ctfd_challenges_dynamic": {
"current": "ctfd:index/getChallengesDynamic:getChallengesDynamic",
"majorVersion": 1,
"majorVersion": 2,
"fields": {
"challenges": {
"maxItemsOne": false,
Expand All @@ -99,7 +99,7 @@
},
"ctfd_challenges_standard": {
"current": "ctfd:index/getChallengesStandard:getChallengesStandard",
"majorVersion": 1,
"majorVersion": 2,
"fields": {
"challenges": {
"maxItemsOne": false,
Expand All @@ -125,7 +125,7 @@
},
"ctfd_teams": {
"current": "ctfd:index/getTeams:getTeams",
"majorVersion": 1,
"majorVersion": 2,
"fields": {
"members": {
"maxItemsOne": false
Expand All @@ -134,7 +134,7 @@
},
"ctfd_users": {
"current": "ctfd:index/getUsers:getUsers",
"majorVersion": 1
"majorVersion": 2
}
}
},
Expand Down
58 changes: 29 additions & 29 deletions provider/cmd/pulumi-resource-ctfd/schema.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.23.2
replace github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20240202163305-e2a20ae13ef9

require (
github.com/ctfer-io/terraform-provider-ctfd/v2 v2.1.1
github.com/ctfer-io/terraform-provider-ctfd/v2 v2.2.0
github.com/pulumi/pulumi-terraform-bridge/v3 v3.102.0
)

Expand Down
4 changes: 2 additions & 2 deletions provider/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/ctfer-io/go-ctfd v0.10.2 h1:DpQSaxcHN7ugC72xlpEl0HIUbusOSolPkWD8Ki7vc7U=
github.com/ctfer-io/go-ctfd v0.10.2/go.mod h1:ebgSW8LdP/qtRCpglK4djBp+g6kU5YM98XBZKowiCeY=
github.com/ctfer-io/terraform-provider-ctfd/v2 v2.1.1 h1:NtiwSQ26dUgoRoY5JaKZANjNtNPitkzmq2TqzfLCVos=
github.com/ctfer-io/terraform-provider-ctfd/v2 v2.1.1/go.mod h1:xXn075uZ3WrNwxagzNke4guvEu+JLwQemk8qhQkRrkg=
github.com/ctfer-io/terraform-provider-ctfd/v2 v2.2.0 h1:ZbbcrpYQTJU76kvfKQNm80Daziuq2QgSk71rZ+GXZZU=
github.com/ctfer-io/terraform-provider-ctfd/v2 v2.2.0/go.mod h1:xXn075uZ3WrNwxagzNke4guvEu+JLwQemk8qhQkRrkg=
github.com/cyphar/filepath-securejoin v0.3.6 h1:4d9N5ykBnSp5Xn2JkhocYDkOpURL/18CYMpo6xB9uWM=
github.com/cyphar/filepath-securejoin v0.3.6/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
32 changes: 17 additions & 15 deletions sdk/dotnet/Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,15 @@ public static string? ApiKey
set => _apiKey.Set(value);
}

private static readonly __Value<string?> _nonce = new __Value<string?>(() => __config.Get("nonce"));
private static readonly __Value<string?> _password = new __Value<string?>(() => __config.Get("password"));
/// <summary>
/// User session nonce, comes with session. Could use `CTFD_NONCE` environment variable instead.
/// The administrator or service account password to login with. Could use `CTFD_ADMIN_PASSWORD` environment variable
/// instead.
/// </summary>
public static string? Nonce
public static string? Password
{
get => _nonce.Get();
set => _nonce.Set(value);
}

private static readonly __Value<string?> _session = new __Value<string?>(() => __config.Get("session"));
/// <summary>
/// User session token, comes with nonce. Could use `CTFD_SESSION` environment variable instead.
/// </summary>
public static string? Session
{
get => _session.Get();
set => _session.Set(value);
get => _password.Get();
set => _password.Set(value);
}

private static readonly __Value<string?> _url = new __Value<string?>(() => __config.Get("url"));
Expand All @@ -74,5 +65,16 @@ public static string? Url
set => _url.Set(value);
}

private static readonly __Value<string?> _username = new __Value<string?>(() => __config.Get("username"));
/// <summary>
/// The administrator or service account username to login with. Could use `CTFD_ADMIN_USERNAME` environment variable
/// instead.
/// </summary>
public static string? Username
{
get => _username.Get();
set => _username.Set(value);
}

}
}
62 changes: 33 additions & 29 deletions sdk/dotnet/Provider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,25 @@ public partial class Provider : global::Pulumi.ProviderResource
public Output<string?> ApiKey { get; private set; } = null!;

/// <summary>
/// User session nonce, comes with session. Could use `CTFD_NONCE` environment variable instead.
/// The administrator or service account password to login with. Could use `CTFD_ADMIN_PASSWORD` environment variable
/// instead.
/// </summary>
[Output("nonce")]
public Output<string?> Nonce { get; private set; } = null!;

/// <summary>
/// User session token, comes with nonce. Could use `CTFD_SESSION` environment variable instead.
/// </summary>
[Output("session")]
public Output<string?> Session { get; private set; } = null!;
[Output("password")]
public Output<string?> Password { get; private set; } = null!;

/// <summary>
/// CTFd base URL (e.g. `https://my-ctf.lan`). Could use `CTFD_URL` environment variable instead.
/// </summary>
[Output("url")]
public Output<string?> Url { get; private set; } = null!;

/// <summary>
/// The administrator or service account username to login with. Could use `CTFD_ADMIN_USERNAME` environment variable
/// instead.
/// </summary>
[Output("username")]
public Output<string?> Username { get; private set; } = null!;


/// <summary>
/// Create a Provider resource with the given unique name, arguments, and options.
Expand All @@ -67,8 +69,8 @@ private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions?
AdditionalSecretOutputs =
{
"apiKey",
"nonce",
"session",
"password",
"username",
},
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
Expand Down Expand Up @@ -98,44 +100,46 @@ public Input<string>? ApiKey
}
}

[Input("nonce")]
private Input<string>? _nonce;
[Input("password")]
private Input<string>? _password;

/// <summary>
/// User session nonce, comes with session. Could use `CTFD_NONCE` environment variable instead.
/// The administrator or service account password to login with. Could use `CTFD_ADMIN_PASSWORD` environment variable
/// instead.
/// </summary>
public Input<string>? Nonce
public Input<string>? Password
{
get => _nonce;
get => _password;
set
{
var emptySecret = Output.CreateSecret(0);
_nonce = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
_password = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
}
}

[Input("session")]
private Input<string>? _session;
/// <summary>
/// CTFd base URL (e.g. `https://my-ctf.lan`). Could use `CTFD_URL` environment variable instead.
/// </summary>
[Input("url")]
public Input<string>? Url { get; set; }

[Input("username")]
private Input<string>? _username;

/// <summary>
/// User session token, comes with nonce. Could use `CTFD_SESSION` environment variable instead.
/// The administrator or service account username to login with. Could use `CTFD_ADMIN_USERNAME` environment variable
/// instead.
/// </summary>
public Input<string>? Session
public Input<string>? Username
{
get => _session;
get => _username;
set
{
var emptySecret = Output.CreateSecret(0);
_session = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
_username = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
}
}

/// <summary>
/// CTFd base URL (e.g. `https://my-ctf.lan`). Could use `CTFD_URL` environment variable instead.
/// </summary>
[Input("url")]
public Input<string>? Url { get; set; }

public ProviderArgs()
{
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/ctfer-io/pulumi-ctfd/sdk
module github.com/ctfer-io/pulumi-ctfd/sdk/v2

go 1.22.3

Expand Down
4 changes: 2 additions & 2 deletions sdk/go/ctfd/challengeDynamic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/ctfd/challengeStandard.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions sdk/go/ctfd/config/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions sdk/go/ctfd/file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading