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

CdkTF example is invalid #28702

Closed
1 task done
Socolin opened this issue Feb 5, 2025 · 1 comment
Closed
1 task done

CdkTF example is invalid #28702

Socolin opened this issue Feb 5, 2025 · 1 comment

Comments

@Socolin
Copy link

Socolin commented Feb 5, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.10.4

AzureRM Provider Version

CDK 13.17.0

Affected Resource(s)/Data Source(s)

azurerm_*

Terraform Configuration Files

using Constructs;
using HashiCorp.Cdktf;
using HashiCorp.Cdktf.Providers.Azurerm.Provider;
using HashiCorp.Cdktf.Providers.Azurerm.ResourceGroup;

// ReSharper disable ObjectCreationAsStatement

namespace Mediaclip.Hub.DevOps.Terraform;

internal class MainStack : TerraformStack
{
	public MainStack(Construct scope, string id)
		: base(scope, id)
	{
		new AzurermProvider(this,
			"AzureRm",
			new AzurermProviderConfig
			{
				Alias = "redacted",
				SubscriptionId = "redacted",
				Features = new IAzurermProviderFeatures[]
				{
					new AzurermProviderFeatures()
				}
			}
		);

		new CloudBackend(this,
			new CloudBackendConfig
			{
				Organization = "redacted",
				Workspaces = new NamedCloudWorkspace("redacted"),
			});

		var buildServerRg = new ResourceGroup(this,
			"redacted",
			new ResourceGroupConfig
			{
				Name = "mc-redacted-rg",
				Location = "eastus",
			});
	}
}

Debug Output/Panic Output

╷
        │ Error: Invalid provider configuration
        │ 
        │ Provider "registry.terraform.io/hashicorp/azurerm" requires explicit
        │ configuration. Add a provider block to the root module and configure the
        │ provider's required arguments as described in the provider documentation.



        │ Error: Missing required argument

        │   with provider["registry.terraform.io/hashicorp/azurerm"],
        │   on <empty> line 0:
        │   (source code not available)

        │ The argument "features" is required, but no definition was found.

Expected Behaviour

It should works

Actual Behaviour

It crash

Steps to Reproduce

cdktf deploy 

Important Factoids

No response

References

Also the example https://github.com/hashicorp/terraform-cdk/blob/main/examples/csharp/azure/Main.cs#L19 is not up-to-date , this line should be

Features = new IAzurermProviderFeatures[]
{
	new AzurermProviderFeatures()
}

Similar to hashicorp/terraform-cdk#3774 but since I don't know who is responsible for that I'm opening an issue on this repo too.

@rcskosir
Copy link
Contributor

rcskosir commented Feb 6, 2025

Thank you for taking the time to open this issue. Since the issue seems to be in the azure example in the CDKTF, this is not part of the domain of this repository. As such, I am going to close this issue. I believe the terraform-cdk is the best place to get that answered. Additionally you could bring it up in a Discuss Forum.

@rcskosir rcskosir closed this as completed Feb 6, 2025
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

No branches or pull requests

2 participants