Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Prepare changelog and version bump for azd core 1.24.0 release.

Changes

  • Version: Updated from 1.24.0-beta.1 to 1.24.0 (2026-02-02)
  • Features: App Service deployment slot routing, external prompting infrastructure for VS Code integration
  • Bug Fix: Duplicate azd-service-name tag validation now correctly filters to host resources only
  • Improvements: Clearer Azure CLI authentication delegation error messages

Extension-only PRs (#6670, #6672) excluded per changelog scope.

Original prompt

This section details on the original issue you should resolve

<issue_title>Terraform provider: Deprecated -state flag warning when using Terraform Cloud (backend "remote" or "cloud")</issue_title>
<issue_description>- [x] Make sure you've installed the latest version using instructions

Output from azd version

azd version 1.23.3 (commit c53baf4180b8636f4366cd9d9f621755db75f370)

Describe the bug
When using azd provision with a Terraform project that uses Terraform Cloud as backend (backend "remote" or the newer cloud block), the following warning is displayed:

│ Warning: Deprecated flag: -state
│ 
│ Use the "path" attribute within the "local" backend to specify a file for
│ state storage

This happens because the isRemoteBackendConfig() function in terraform_provider.go only checks for backend "azurerm":

// Gets the path to the project parameters file path
func (t *TerraformProvider) parametersTemplateFilePath() string {
infraPath := t.options.Path
if strings.TrimSpace(infraPath) == "" {
infraPath = "infra"
}
parametersFilename := fmt.Sprintf("%s.tfvars.json", t.options.Module)
return filepath.Join(t.projectPath, infraPath, parametersFilename)
}
// Gets the path to the project backend config file path
func (t *TerraformProvider) backendConfigTemplateFilePath() string {

for index := range files {
    if !files[index].IsDir() && filepath.Ext(files[index].Name()) == ".tf" {
        fileContent, err := os.ReadFile(filepath.Join(modulePath, files[index].Name()))
        if err != nil {
            return false, fmt.Errorf("error reading .tf files: %w", err)
        }
        if found := strings.Contains(string(fileContent), `backend "azurerm"`); found {
            return true, nil
        }
    }
}
return false, nil

When isRemoteBackendConfig() returns false, the -state flag is added to terraform commands (plan, apply, destroy, output, show), which causes the deprecation warning.

To Reproduce

  1. Create an azd project with Terraform provider
  2. Configure Terraform to use Terraform Cloud backend:
    terraform {
      cloud {
        hostname     = "app.terraform.io"
        organization = "your-org"
        workspaces {
          name = "your-workspace"
        }
      }
    }
    Or the older syntax:
    terraform {
      backend "remote" {
        hostname     = "app.terraform.io"
        organization = "your-org"
        workspaces {
          name = "your-workspace"
        }
      }
    }
  3. Run azd provision
  4. Observe the deprecation warning about -state flag

Expected behavior
The isRemoteBackendConfig() function should recognize all remote backend types:

  • backend "azurerm"
  • backend "remote"
  • backend "s3"
  • backend "gcs"
  • cloud { block (Terraform Cloud/Enterprise)
  • etc.

Or alternatively, check for the absence of backend "local" instead of checking for specific remote backends.

Environment

  • Terraform version: 1.14.4
  • OS: macOS (also reproducible in devcontainer with Ubuntu 24.04)
  • IDE: VS Code with devcontainer

Additional context
The warning does not affect functionality since Terraform Cloud manages state remotely and ignores the -state flag. However, it creates confusion and noise in the output.

Suggested fix
Update isRemoteBackendConfig() to detect additional remote backend types:

func (t *TerraformProvider) isRemoteBackendConfig() (bool, error) {
    modulePath := t.modulePath()
    infraDir, _ := os.Open(modulePath)
    files, err := infraDir.ReadDir(0)

    if err != nil {
        return false, fmt.Errorf("reading .tf files contents: %w", err)
    }

    remoteBackends := []string{
        `backend "azurerm"`,
        `backend "remote"`,
        `backend "s3"`,
        `backend "gcs"`,
        `backend "consul"`,
        `backend "cos"`,
        `backend "http"`,
        `backend "kubernetes"`,
        `backend "oss"`,
        `backend "pg"`,
        `cloud {`,
    }

    for index := range files {
        if !files[index].IsDir() && filepath.Ext(files[index].Name()) == ".tf" {
            fileContent, err := os.ReadFile(filepath.Join(modulePath, files[index].Name()))
            if err != nil {
                return false, fmt.Errorf("error reading .tf files: %w", err)
            }
            for _, backend := range remoteBackends {
                if strings.Contains(string(fileContent), backend) {
                    return true, nil
                }
            }
        }
    }
    return false, nil
}

</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: Generate changelog (azd core)
Update azd core release changelog and version based on merged PRs.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: vhvb1989 <24213737+vhvb1989@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix deprecated -state flag warning for Terraform Cloud Release azd core v1.24.0 Feb 2, 2026
Copilot AI requested a review from vhvb1989 February 2, 2026 03:07
@vhvb1989 vhvb1989 closed this Feb 2, 2026
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

Successfully merging this pull request may close these issues.

Terraform provider: Deprecated -state flag warning when using Terraform Cloud (backend "remote" or "cloud")

2 participants