code: func PathToAttributePath(p cty.Path) *proto.AttributePath {
  	ap := &proto.AttributePath{}
  	for _, step := range p {
  		switch selector := step.(type) {
  		case cty.GetAttrStep:
  			ap.Steps = append(ap.Steps, &proto.AttributePath_Step{
  				Selector: &proto.AttributePath_Step_AttributeName{
  					AttributeName: selector.Name,
  				},
  			})
  		case cty.IndexStep:
  			key := selector.Key
  			switch key.Type() {
  			case cty.String:
  				ap.Steps = append(ap.Steps, &proto.AttributePath_Step{
  					Selector: &proto.AttributePath_Step_ElementKeyString{
  						ElementKeyString: key.AsString(),
  					},
  				})
  			case cty.Number:
  				v, _ := key.AsBigFloat().Int64()
  				ap.Steps = append(ap.Steps, &proto.AttributePath_Step{
  					Selector: &proto.AttributePath_Step_ElementKeyInt{
  						ElementKeyInt: v,
  					},
  				})
  			default:
  				// We'll bail early if we encounter anything else, and just
  				// return the valid prefix.
  				return ap
  			}
  		}
  	}
  	return ap
  }
docs: // AttributePathToPath takes a cty.Path and converts it to a proto-encoded path.