Skip to content

Commit

Permalink
Merge pull request #146 from pulumi/jkodroff/v3.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
stack72 authored Feb 8, 2022
2 parents 0648a1a + 5c5583b commit c373dda
Show file tree
Hide file tree
Showing 240 changed files with 17,771 additions and 4,618 deletions.
2,729 changes: 2,049 additions & 680 deletions provider/cmd/pulumi-resource-gitlab/schema.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/pulumi/pulumi-gitlab/provider/v4
go 1.16

require (
github.com/gitlabhq/terraform-provider-gitlab v1.3.1-0.20211115082505-76764869680c
github.com/hashicorp/terraform-plugin-sdk v1.16.1
github.com/gitlabhq/terraform-provider-gitlab v1.3.1-0.20220206200041-8fc37b8c1706
github.com/pulumi/pulumi-terraform-bridge/v3 v3.18.0
github.com/pulumi/pulumi/sdk/v3 v3.23.2
)

replace (
github.com/hashicorp/go-getter v1.5.0 => github.com/hashicorp/go-getter v1.4.0
github.com/hashicorp/terraform-plugin-sdk/v2 => github.com/pulumi/terraform-plugin-sdk/v2 v2.0.0-20210629210550-59d24255d71f
github.com/hashicorp/terraform-plugin-test => github.com/hashicorp/terraform-plugin-test v1.3.0
github.com/hashicorp/vault => github.com/hashicorp/vault v1.2.0
)
83 changes: 28 additions & 55 deletions provider/go.sum

Large diffs are not rendered by default.

61 changes: 52 additions & 9 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import (
"unicode"

"github.com/gitlabhq/terraform-provider-gitlab/gitlab"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/pulumi/pulumi-gitlab/provider/v4/pkg/version"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
shimv1 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v1"
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
)

Expand Down Expand Up @@ -63,7 +62,7 @@ func gitLabResource(mod string, res string) tokens.Type {

// Provider returns additional overlaid schema and metadata associated with the GitLab package.
func Provider() tfbridge.ProviderInfo {
p := shimv1.NewProvider(gitlab.Provider().(*schema.Provider))
p := shimv2.NewProvider(gitlab.Provider())
prov := tfbridge.ProviderInfo{
P: p,
Name: "gitlab",
Expand Down Expand Up @@ -112,14 +111,58 @@ func Provider() tfbridge.ProviderInfo {
"gitlab_group_share_group": {Tok: gitLabResource(gitLabMod, "GroupShareGroup")},
"gitlab_project_freeze_period": {Tok: gitLabResource(gitLabMod, "ProjectFreezePeriod")},
"gitlab_project_badge": {Tok: gitLabResource(gitLabMod, "ProjectBadge")},
"gitlab_group_badge": {Tok: gitLabResource(gitLabMod, "GroupBadge")},
"gitlab_group_custom_attribute": {Tok: gitLabResource(gitLabMod, "GroupCustomAttribute")},
"gitlab_managed_license": {Tok: gitLabResource(gitLabMod, "ManagedLicense")},
"gitlab_project_access_token": {Tok: gitLabResource(gitLabMod, "ProjectAccessToken")},
"gitlab_project_custom_attribute": {Tok: gitLabResource(gitLabMod, "ProjectCustomAttribute")},
"gitlab_repository_file": {Tok: gitLabResource(gitLabMod, "RepositoryFile")},
"gitlab_service_microsoft_teams": {Tok: gitLabResource(gitLabMod, "ServiceMicrosoftTeams")},
"gitlab_user_custom_attribute": {Tok: gitLabResource(gitLabMod, "UserCustomAttribute")},
},
DataSources: map[string]*tfbridge.DataSourceInfo{
"gitlab_group": {Tok: gitLabDataSource(gitLabMod, "getGroup")},
"gitlab_project": {Tok: gitLabDataSource(gitLabMod, "getProject")},
"gitlab_user": {Tok: gitLabDataSource(gitLabMod, "getUser")},
"gitlab_users": {Tok: gitLabDataSource(gitLabMod, "getUsers")},
"gitlab_projects": {Tok: gitLabDataSource(gitLabMod, "getProjects")},
"gitlab_group_membership": {Tok: gitLabDataSource(gitLabMod, "getGroupMembership")},
"gitlab_group": {Tok: gitLabDataSource(gitLabMod, "getGroup")},
"gitlab_project": {
Tok: gitLabDataSource(gitLabMod, "getProject"),
Fields: map[string]*tfbridge.SchemaInfo{
"push_rules": {
Name: "pushRules",
MaxItemsOne: tfbridge.True(),
},
},
},
"gitlab_user": {Tok: gitLabDataSource(gitLabMod, "getUser")},
"gitlab_users": {Tok: gitLabDataSource(gitLabMod, "getUsers")},
"gitlab_projects": {
Tok: gitLabDataSource(gitLabMod, "getProjects"),
Fields: map[string]*tfbridge.SchemaInfo{
"projects": {
Elem: &tfbridge.SchemaInfo{
Fields: map[string]*tfbridge.SchemaInfo{
"permissions": {
Name: "permissions",
MaxItemsOne: tfbridge.True(),
},
"namespace": {
Name: "namespace",
MaxItemsOne: tfbridge.True(),
},
"forked_from_project": {
Name: "forkedFromProject",
MaxItemsOne: tfbridge.True(),
},
"owner": {
Name: "owner",
MaxItemsOne: tfbridge.True(),
},
},
},
},
},
},
"gitlab_group_membership": {Tok: gitLabDataSource(gitLabMod, "getGroupMembership")},
"gitlab_project_protected_branch": {Tok: gitLabDataSource(gitLabMod, "getProjectProtectedBranch")},
"gitlab_project_protected_branches": {Tok: gitLabDataSource(gitLabMod, "getProjectProtectedBranches")},
},
JavaScript: &tfbridge.JavaScriptInfo{
Dependencies: map[string]string{
Expand Down
89 changes: 32 additions & 57 deletions sdk/dotnet/BranchProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,60 +10,13 @@
namespace Pulumi.GitLab
{
/// <summary>
/// ## # gitlab\_branch\_protection
///
/// This resource allows you to protect a specific branch by an access level so that the user with less access level cannot Merge/Push to the branch.
///
/// &gt; The `allowed_to_push`, `allowed_to_merge` and `code_owner_approval_required` arguments require a GitLab Premium account or above. Please refer to [Gitlab API documentation](https://docs.gitlab.com/ee/api/protected_branches.html) for further information.
///
/// ## Example Usage
///
/// ```csharp
/// using Pulumi;
/// using GitLab = Pulumi.GitLab;
///
/// class MyStack : Stack
/// {
/// public MyStack()
/// {
/// var branchProtect = new GitLab.BranchProtection("branchProtect", new GitLab.BranchProtectionArgs
/// {
/// AllowedToMerges =
/// {
/// new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
/// {
/// UserId = 15,
/// },
/// new GitLab.Inputs.BranchProtectionAllowedToMergeArgs
/// {
/// UserId = 37,
/// },
/// },
/// AllowedToPushes =
/// {
/// new GitLab.Inputs.BranchProtectionAllowedToPushArgs
/// {
/// UserId = 5,
/// },
/// new GitLab.Inputs.BranchProtectionAllowedToPushArgs
/// {
/// UserId = 521,
/// },
/// },
/// Branch = "BranchProtected",
/// CodeOwnerApprovalRequired = true,
/// MergeAccessLevel = "developer",
/// Project = "12345",
/// PushAccessLevel = "developer",
/// });
/// }
///
/// }
/// ```
///
/// ## Import
///
/// Gitlab protected branches can be imported with a key composed of `&lt;project_id&gt;:&lt;branch&gt;`, e.g.
/// # Gitlab protected branches can be imported with a key composed of `&lt;project_id&gt;:&lt;branch&gt;`, e.g.
///
/// ```sh
/// $ pulumi import gitlab:index/branchProtection:BranchProtection BranchProtect "12345:main"
Expand All @@ -72,9 +25,15 @@ namespace Pulumi.GitLab
[GitLabResourceType("gitlab:index/branchProtection:BranchProtection")]
public partial class BranchProtection : Pulumi.CustomResource
{
/// <summary>
/// Defines permissions for action.
/// </summary>
[Output("allowedToMerges")]
public Output<ImmutableArray<Outputs.BranchProtectionAllowedToMerge>> AllowedToMerges { get; private set; } = null!;

/// <summary>
/// Defines permissions for action.
/// </summary>
[Output("allowedToPushes")]
public Output<ImmutableArray<Outputs.BranchProtectionAllowedToPush>> AllowedToPushes { get; private set; } = null!;

Expand All @@ -91,13 +50,13 @@ public partial class BranchProtection : Pulumi.CustomResource
public Output<int> BranchProtectionId { get; private set; } = null!;

/// <summary>
/// Bool, defaults to false. Can be set to true to require code owner approval before merging.
/// Can be set to true to require code owner approval before merging.
/// </summary>
[Output("codeOwnerApprovalRequired")]
public Output<bool?> CodeOwnerApprovalRequired { get; private set; } = null!;

/// <summary>
/// One of five levels of access to the project. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
/// Access levels allowed to merge. Valid values are: `no one`, `developer`, `maintainer`.
/// </summary>
[Output("mergeAccessLevel")]
public Output<string> MergeAccessLevel { get; private set; } = null!;
Expand All @@ -109,7 +68,7 @@ public partial class BranchProtection : Pulumi.CustomResource
public Output<string> Project { get; private set; } = null!;

/// <summary>
/// One of five levels of access to the project. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
/// Access levels allowed to push. Valid values are: `no one`, `developer`, `maintainer`.
/// </summary>
[Output("pushAccessLevel")]
public Output<string> PushAccessLevel { get; private set; } = null!;
Expand Down Expand Up @@ -162,6 +121,10 @@ public sealed class BranchProtectionArgs : Pulumi.ResourceArgs
{
[Input("allowedToMerges")]
private InputList<Inputs.BranchProtectionAllowedToMergeArgs>? _allowedToMerges;

/// <summary>
/// Defines permissions for action.
/// </summary>
public InputList<Inputs.BranchProtectionAllowedToMergeArgs> AllowedToMerges
{
get => _allowedToMerges ?? (_allowedToMerges = new InputList<Inputs.BranchProtectionAllowedToMergeArgs>());
Expand All @@ -170,6 +133,10 @@ public InputList<Inputs.BranchProtectionAllowedToMergeArgs> AllowedToMerges

[Input("allowedToPushes")]
private InputList<Inputs.BranchProtectionAllowedToPushArgs>? _allowedToPushes;

/// <summary>
/// Defines permissions for action.
/// </summary>
public InputList<Inputs.BranchProtectionAllowedToPushArgs> AllowedToPushes
{
get => _allowedToPushes ?? (_allowedToPushes = new InputList<Inputs.BranchProtectionAllowedToPushArgs>());
Expand All @@ -183,13 +150,13 @@ public InputList<Inputs.BranchProtectionAllowedToPushArgs> AllowedToPushes
public Input<string> Branch { get; set; } = null!;

/// <summary>
/// Bool, defaults to false. Can be set to true to require code owner approval before merging.
/// Can be set to true to require code owner approval before merging.
/// </summary>
[Input("codeOwnerApprovalRequired")]
public Input<bool>? CodeOwnerApprovalRequired { get; set; }

/// <summary>
/// One of five levels of access to the project. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
/// Access levels allowed to merge. Valid values are: `no one`, `developer`, `maintainer`.
/// </summary>
[Input("mergeAccessLevel", required: true)]
public Input<string> MergeAccessLevel { get; set; } = null!;
Expand All @@ -201,7 +168,7 @@ public InputList<Inputs.BranchProtectionAllowedToPushArgs> AllowedToPushes
public Input<string> Project { get; set; } = null!;

/// <summary>
/// One of five levels of access to the project. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
/// Access levels allowed to push. Valid values are: `no one`, `developer`, `maintainer`.
/// </summary>
[Input("pushAccessLevel", required: true)]
public Input<string> PushAccessLevel { get; set; } = null!;
Expand All @@ -215,6 +182,10 @@ public sealed class BranchProtectionState : Pulumi.ResourceArgs
{
[Input("allowedToMerges")]
private InputList<Inputs.BranchProtectionAllowedToMergeGetArgs>? _allowedToMerges;

/// <summary>
/// Defines permissions for action.
/// </summary>
public InputList<Inputs.BranchProtectionAllowedToMergeGetArgs> AllowedToMerges
{
get => _allowedToMerges ?? (_allowedToMerges = new InputList<Inputs.BranchProtectionAllowedToMergeGetArgs>());
Expand All @@ -223,6 +194,10 @@ public InputList<Inputs.BranchProtectionAllowedToMergeGetArgs> AllowedToMerges

[Input("allowedToPushes")]
private InputList<Inputs.BranchProtectionAllowedToPushGetArgs>? _allowedToPushes;

/// <summary>
/// Defines permissions for action.
/// </summary>
public InputList<Inputs.BranchProtectionAllowedToPushGetArgs> AllowedToPushes
{
get => _allowedToPushes ?? (_allowedToPushes = new InputList<Inputs.BranchProtectionAllowedToPushGetArgs>());
Expand All @@ -242,13 +217,13 @@ public InputList<Inputs.BranchProtectionAllowedToPushGetArgs> AllowedToPushes
public Input<int>? BranchProtectionId { get; set; }

/// <summary>
/// Bool, defaults to false. Can be set to true to require code owner approval before merging.
/// Can be set to true to require code owner approval before merging.
/// </summary>
[Input("codeOwnerApprovalRequired")]
public Input<bool>? CodeOwnerApprovalRequired { get; set; }

/// <summary>
/// One of five levels of access to the project. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
/// Access levels allowed to merge. Valid values are: `no one`, `developer`, `maintainer`.
/// </summary>
[Input("mergeAccessLevel")]
public Input<string>? MergeAccessLevel { get; set; }
Expand All @@ -260,7 +235,7 @@ public InputList<Inputs.BranchProtectionAllowedToPushGetArgs> AllowedToPushes
public Input<string>? Project { get; set; }

/// <summary>
/// One of five levels of access to the project. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
/// Access levels allowed to push. Valid values are: `no one`, `developer`, `maintainer`.
/// </summary>
[Input("pushAccessLevel")]
public Input<string>? PushAccessLevel { get; set; }
Expand Down
30 changes: 25 additions & 5 deletions sdk/dotnet/Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public void Set(T value)

private static readonly __Value<string?> _baseUrl = new __Value<string?>(() => __config.Get("baseUrl"));
/// <summary>
/// The GitLab Base API URL
/// This is the target GitLab base API endpoint. Providing a value is a requirement when working with GitLab CE or GitLab
/// Enterprise e.g. `https://my.gitlab.server/api/v4/`. It is optional to provide this value and it can also be sourced from
/// the `GITLAB_BASE_URL` environment variable. The value must end with a slash.
/// </summary>
public static string? BaseUrl
{
Expand All @@ -44,7 +46,8 @@ public static string? BaseUrl

private static readonly __Value<string?> _cacertFile = new __Value<string?>(() => __config.Get("cacertFile"));
/// <summary>
/// A file containing the ca certificate to use in case ssl certificate is not from a standard chain
/// This is a file containing the ca cert to verify the gitlab instance. This is available for use when working with GitLab
/// CE or Gitlab Enterprise with a locally-issued or self-signed certificate chain.
/// </summary>
public static string? CacertFile
{
Expand All @@ -64,17 +67,31 @@ public static string? ClientCert

private static readonly __Value<string?> _clientKey = new __Value<string?>(() => __config.Get("clientKey"));
/// <summary>
/// File path to client key when GitLab instance is behind company proxy. File must contain PEM encoded data.
/// File path to client key when GitLab instance is behind company proxy. File must contain PEM encoded data. Required when
/// `client_cert` is set.
/// </summary>
public static string? ClientKey
{
get => _clientKey.Get();
set => _clientKey.Set(value);
}

private static readonly __Value<bool?> _earlyAuthCheck = new __Value<bool?>(() => __config.GetBoolean("earlyAuthCheck"));
/// <summary>
/// (Experimental) By default the provider does a dummy request to get the current user in order to verify that the provider
/// configuration is correct and the GitLab API is reachable. Turn it off, to skip this check. This may be useful if the
/// GitLab instance does not yet exist and is created within the same terraform module. This is an experimental feature and
/// may change in the future. Please make sure to always keep backups of your state.
/// </summary>
public static bool? EarlyAuthCheck
{
get => _earlyAuthCheck.Get();
set => _earlyAuthCheck.Set(value);
}

private static readonly __Value<bool?> _insecure = new __Value<bool?>(() => __config.GetBoolean("insecure"));
/// <summary>
/// Disable SSL verification of API calls
/// When set to true this disables SSL verification of the connection to the GitLab instance.
/// </summary>
public static bool? Insecure
{
Expand All @@ -84,7 +101,10 @@ public static bool? Insecure

private static readonly __Value<string?> _token = new __Value<string?>(() => __config.Get("token"));
/// <summary>
/// The OAuth2 token or project/personal access token used to connect to GitLab.
/// The OAuth2 Token, Project, Group, Personal Access Token or CI Job Token used to connect to GitLab. The OAuth method is
/// used in this provider for authentication (using Bearer authorization token). See
/// https://docs.gitlab.com/ee/api/#authentication for details. It may be sourced from the `GITLAB_TOKEN` environment
/// variable.
/// </summary>
public static string? Token
{
Expand Down
4 changes: 1 addition & 3 deletions sdk/dotnet/DeployKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
namespace Pulumi.GitLab
{
/// <summary>
/// ## # gitlab\_deploy\_key
///
/// This resource allows you to create and manage [deploy keys](https://docs.gitlab.com/ee/user/project/deploy_keys/) for your GitLab projects.
///
/// ## Example Usage
Expand All @@ -37,7 +35,7 @@ namespace Pulumi.GitLab
///
/// ## Import
///
/// GitLab deploy keys can be imported using an id made up of `{project_id}:{deploy_key_id}`, e.g.
/// # GitLab deploy keys can be imported using an id made up of `{project_id}:{deploy_key_id}`, e.g.
///
/// ```sh
/// $ pulumi import gitlab:index/deployKey:DeployKey test 1:3
Expand Down
Loading

0 comments on commit c373dda

Please sign in to comment.